diff options
author | Thomas Pfaff <tpfaff@gmx.net> | 2003-01-09 20:51:55 +0000 |
---|---|---|
committer | Thomas Pfaff <tpfaff@gmx.net> | 2003-01-09 20:51:55 +0000 |
commit | 72fcbc3ee690a028128274d2bd0ad694961b5e5f (patch) | |
tree | 5e23945897f32019001c1f0c8e45101ae5b6ece8 /winsup/testsuite/winsup.api/pthread/mutex5.c | |
parent | 8ccfe116d0c9ec3afb1cff7f8d41512c8f63466e (diff) | |
download | cygnal-72fcbc3ee690a028128274d2bd0ad694961b5e5f.tar.gz cygnal-72fcbc3ee690a028128274d2bd0ad694961b5e5f.tar.bz2 cygnal-72fcbc3ee690a028128274d2bd0ad694961b5e5f.zip |
Add pthread_mutex tests
Diffstat (limited to 'winsup/testsuite/winsup.api/pthread/mutex5.c')
-rw-r--r-- | winsup/testsuite/winsup.api/pthread/mutex5.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/winsup/testsuite/winsup.api/pthread/mutex5.c b/winsup/testsuite/winsup.api/pthread/mutex5.c new file mode 100644 index 000000000..5cb1478b8 --- /dev/null +++ b/winsup/testsuite/winsup.api/pthread/mutex5.c @@ -0,0 +1,30 @@ +/* + * 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; + int success = 0; /* Use to quell GNU compiler warnings. */ + + assert(success = PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_ERRORCHECK); + assert(success = PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_RECURSIVE); + assert(success = PTHREAD_MUTEX_RECURSIVE != PTHREAD_MUTEX_ERRORCHECK); + + if (success == success) + { + assert(pthread_mutexattr_init(&mxAttr) == 0); + assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); + assert(mxType == PTHREAD_MUTEX_ERRORCHECK); + } + + return 0; +} |