diff options
author | rpj <rpj> | 2001-05-31 02:05:25 +0000 |
---|---|---|
committer | rpj <rpj> | 2001-05-31 02:05:25 +0000 |
commit | a8744086b476e4007c1d8fc0fae84ecfcade99ba (patch) | |
tree | 69bd3bd925233e00d960f3de5a5f3953db235da7 /tests/mutex5.c | |
parent | e121b938c9f012958196a3141f04a3fd4f58bdb9 (diff) |
New test.
Diffstat (limited to 'tests/mutex5.c')
-rw-r--r-- | tests/mutex5.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/mutex5.c b/tests/mutex5.c new file mode 100644 index 0000000..6a9a917 --- /dev/null +++ b/tests/mutex5.c @@ -0,0 +1,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; +} |