diff options
author | rpj <rpj> | 1998-08-06 06:18:07 +0000 |
---|---|---|
committer | rpj <rpj> | 1998-08-06 06:18:07 +0000 |
commit | ad2fc723a301cf4e6cda882d93199548d525c879 (patch) | |
tree | 2e4d80dcc9b66d99f1b16e8b8b83740087739807 /sync.c | |
parent | 20ebb838b7d10a0f315ae399439f71dd7bcba764 (diff) |
Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au>
* sync.c (pthread_join): Remove target_thread_mutex and it's
initialisation. Rename getdetachedstate to getdetachstate.
Remove unused variable "exitcode".
(pthread_detach): Remove target_thread_mutex and it's
initialisation. Rename getdetachedstate to getdetachstate.
Rename setdetachedstate to setdetachstate.
Diffstat (limited to 'sync.c')
-rw-r--r-- | sync.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -55,7 +55,6 @@ int pthread_join(pthread_t thread, void ** valueptr) { - LPDWORD exitcode; int detachstate; /* First check if we are trying to join to ourselves. */ @@ -66,18 +65,15 @@ pthread_join(pthread_t thread, void ** valueptr) if (thread != NULL) { - pthread_mutex_t * target_thread_mutex; int ret; - target_thread_mutex = _PTHREAD_THREAD_MUTEX(thread); - /* CRITICAL SECTION */ pthread_mutex_lock(&_pthread_table_mutex); /* If the thread is in DETACHED state, then join will return immediately. */ - if (pthread_attr_getdetachedstate(&(thread->attr), &detachstate) != 0 + if (pthread_attr_getdetachstate(&(thread->attr), &detachstate) != 0 || detachstate == PTHREAD_CREATE_DETACHED) { return EINVAL; @@ -120,14 +116,14 @@ pthread_join(pthread_t thread, void ** valueptr) pointed to by thread->joinvalueptr has been freed or otherwise no longer valid. */ - if (pthread_attr_getdetachedstate(&(thread->attr), &detachstate) != 0 + if (pthread_attr_getdetachstate(&(thread->attr), &detachstate) != 0 || detachstate == PTHREAD_CREATE_DETACHED) { ret = EDEADLK; } else { - *value_ptr = thread->joinvalueptr; + *valueptr = thread->joinvalueptr; ret = 0; } @@ -155,7 +151,6 @@ pthread_detach(pthread_t thread) { int detachstate; int ret; - pthread_mutex_t * target_thread_mutex; /* CRITICAL SECTION */ pthread_mutex_lock(&_pthread_table_mutex); @@ -166,22 +161,18 @@ pthread_detach(pthread_t thread) } else { - - target_thread_mutex = _PTHREAD_THREAD_MUTEX(thread); - /* Check that we can detach this thread. */ - if (pthread_attr_getdetachedstate(&(thread->attr), &detachstate) != 0 + if (pthread_attr_getdetachstate(&(thread->attr), &detachstate) != 0 || detachstate == PTHREAD_CREATE_DETACHED) { ret = EINVAL; } else { - /* This is all we do here - the rest is done either when the thread exits or when pthread_join() exits. Once this is set it will never be unset. */ - pthread_attr_setdetachedstate(&(thread->attr), + pthread_attr_setdetachstate(&(thread->attr), PTHREAD_CREATE_DETACHED); ret = 0; |