blob: 6a9a91788902311b91c7d713e91089033ded39d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* mutex5.c
*
* Confirm the equality/inequality of the various mutex types,
* and the default not-set value.
*/
#include "test.h"
static pthread_mutexattr_t mxAttr;
int
main()
{
int mxType = -1;
assert(PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL);
assert(PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_ERRORCHECK);
assert(PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_RECURSIVE);
assert(PTHREAD_MUTEX_RECURSIVE != PTHREAD_MUTEX_ERRORCHECK);
assert(PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_FAST_NP);
assert(PTHREAD_MUTEX_RECURSIVE == PTHREAD_MUTEX_RECURSIVE_NP);
assert(PTHREAD_MUTEX_ERRORCHECK == PTHREAD_MUTEX_ERRORCHECK_NP);
assert(pthread_mutexattr_init(&mxAttr) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_NORMAL);
return 0;
}
|