diff options
author | rpj <rpj> | 2004-11-03 01:08:41 +0000 |
---|---|---|
committer | rpj <rpj> | 2004-11-03 01:08:41 +0000 |
commit | ec8290acdaea21b16d98f1ef5d4ae8a28ab2109a (patch) | |
tree | 0bd3750ec1cc12594b6cfe69473e393da6ec101b /tests/condvar7.c | |
parent | cccaf0c2c82e78a72d69a4a50c872f308bed2f65 (diff) |
Mutex, semaphore, thread ID, test suite changes - see ChangeLogs
Diffstat (limited to 'tests/condvar7.c')
-rw-r--r-- | tests/condvar7.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/condvar7.c b/tests/condvar7.c index a5bf4bf..9e0b29c 100644 --- a/tests/condvar7.c +++ b/tests/condvar7.c @@ -159,7 +159,7 @@ main() cvthing.shared = 0; - assert((t[0] = pthread_self()) != NULL); + assert((t[0] = pthread_self()).p != NULL); assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); @@ -174,7 +174,7 @@ main() abstime.tv_sec += 10; - assert((t[0] = pthread_self()) != NULL); + assert((t[0] = pthread_self()).p != NULL); awoken = 0; @@ -196,15 +196,15 @@ main() */ Sleep(1000); - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - /* * Cancel one of the threads. */ - assert(pthread_cancel(t[3]) == 0); - Sleep(500); + assert(pthread_cancel(t[1]) == 0); + assert(pthread_join(t[1], NULL) == 0); + + assert(pthread_mutex_lock(&cvthing.lock) == 0); + + cvthing.shared++; /* * Signal all remaining waiting threads. @@ -214,9 +214,10 @@ main() assert(pthread_mutex_unlock(&cvthing.lock) == 0); /* - * Give threads time to complete. + * Wait for all threads to complete. */ - Sleep(2000); + for (i = 2; i <= NUMTHREADS; i++) + assert(pthread_join(t[i], NULL) == 0); /* * Cleanup the CV. |