diff options
Diffstat (limited to 'tests/condvar3.c')
-rw-r--r-- | tests/condvar3.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/condvar3.c b/tests/condvar3.c index aeeb915..8fa9ef7 100644 --- a/tests/condvar3.c +++ b/tests/condvar3.c @@ -97,25 +97,29 @@ mythread(void * arg) shared++; - assert(pthread_mutex_unlock(&mutex) == 0); - if ((result = pthread_cond_signal(&cv)) != 0) { printf("Error = %s\n", error_string[result]); } assert(result == 0); + assert(pthread_mutex_unlock(&mutex) == 0); + return (void *) 0; } int main() { + pthread_attr_t attr; pthread_t t[NUMTHREADS]; struct timespec abstime = { 0, 0 }; struct _timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; + assert(pthread_attr_init(&attr) == 0); + assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); + assert((t[0] = pthread_self()) != NULL); assert(pthread_cond_init(&cv, NULL) == 0); @@ -130,7 +134,7 @@ main() abstime.tv_sec = currSysTime.time; abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); + assert(pthread_create(&t[1], &attr, mythread, (void *) 1) == 0); abstime.tv_sec += 5; |