summaryrefslogtreecommitdiff
path: root/tests/condvar3.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-10-22 15:06:41 +0000
committerrpj <rpj>2004-10-22 15:06:41 +0000
commit045278e11b53fc1ad59945427feab1cd9275988f (patch)
treeda8570a7a8962d9563814c4910e8a9d5fb6fa685 /tests/condvar3.c
parentf84df26e12431bb9ecd07fbc52c804538635901f (diff)
Changes to mutexes and semaphores - considered alpha for now
Diffstat (limited to 'tests/condvar3.c')
-rw-r--r--tests/condvar3.c10
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;