diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-06-25 19:36:00 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-06-25 19:36:00 +0000 |
commit | 3387a425e65b839b68bd2973f6bc5ab22315cc5d (patch) | |
tree | 375713a0b865b10b9eddd9c9877ad68cf0bdc851 /linuxthreads/join.c | |
parent | d47aac39992cb1dd705d8c584f4d3979d7ce4602 (diff) | |
download | glibc-3387a425e65b839b68bd2973f6bc5ab22315cc5d.tar.gz glibc-3387a425e65b839b68bd2973f6bc5ab22315cc5d.tar.xz glibc-3387a425e65b839b68bd2973f6bc5ab22315cc5d.zip |
Finish user stack support. Change locking code to be safe in situations with different priorities.
1998-06-25 19:27 Ulrich Drepper <drepper@cygnus.com> * attr.c: Finish user stack support. Change locking code to be safe in situations with different priorities. * cancel.c: Likewise. * condvar.c: Likewise. * internals.h: Likewise. * join.c: Likewise. * manager.c: Likewise. * mutex.c: Likewise. * pthread.c: Likewise. * ptlongjmp.c: Likewise. * queue.h: Likewise. * rwlock.c: Likewise. * semaphore.c: Likewise. * semaphore.h: Likewise. * signals.c: Likewise. * spinlock.c: Likewise. * spinlock.h: Likewise. Patches by Xavier leroy. 1998-06-25 Ulrich Drepper <drepper@cygnus.com> * sysdeps/pthread/pthread.h: Make [sg]et_stacksize and [sg]et_stackaddr prototypes always available. * sysdeps/unix/sysv/linux/bits/posix_opt.h: Define _POSIX_THREAD_ATTR_STACKSIZE and _POSIX_THREAD_ATTR_STACKADDR.
Diffstat (limited to 'linuxthreads/join.c')
-rw-r--r-- | linuxthreads/join.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/linuxthreads/join.c b/linuxthreads/join.c index 2bdc189631..c59de6985a 100644 --- a/linuxthreads/join.c +++ b/linuxthreads/join.c @@ -35,13 +35,13 @@ void pthread_exit(void * retval) __pthread_perform_cleanup(); __pthread_destroy_specifics(); /* Store return value */ - acquire(self->p_spinlock); + __pthread_lock(self->p_lock); self->p_retval = retval; /* Say that we've terminated */ self->p_terminated = 1; /* See if someone is joining on us */ joining = self->p_joining; - release(self->p_spinlock); + __pthread_unlock(self->p_lock); /* Restart joining thread if any */ if (joining != NULL) restart(joining); /* If this is the initial thread, block until all threads have terminated. @@ -65,36 +65,36 @@ int pthread_join(pthread_t thread_id, void ** thread_return) pthread_handle handle = thread_handle(thread_id); pthread_descr th; - acquire(&handle->h_spinlock); + __pthread_lock(&handle->h_lock); if (invalid_handle(handle, thread_id)) { - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); return ESRCH; } th = handle->h_descr; if (th == self) { - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); return EDEADLK; } /* If detached or already joined, error */ if (th->p_detached || th->p_joining != NULL) { - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); return EINVAL; } /* If not terminated yet, suspend ourselves. */ if (! th->p_terminated) { th->p_joining = self; - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); suspend_with_cancellation(self); /* This is a cancellation point */ if (self->p_canceled && self->p_cancelstate == PTHREAD_CANCEL_ENABLE) { th->p_joining = NULL; pthread_exit(PTHREAD_CANCELED); } - acquire(&handle->h_spinlock); + __pthread_lock(&handle->h_lock); } /* Get return value */ if (thread_return != NULL) *thread_return = th->p_retval; - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); /* Send notification to thread manager */ if (__pthread_manager_request >= 0) { request.req_thread = self; @@ -113,26 +113,26 @@ int pthread_detach(pthread_t thread_id) pthread_handle handle = thread_handle(thread_id); pthread_descr th; - acquire(&handle->h_spinlock); + __pthread_lock(&handle->h_lock); if (invalid_handle(handle, thread_id)) { - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); return ESRCH; } th = handle->h_descr; /* If already detached, error */ if (th->p_detached) { - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); return EINVAL; } /* If already joining, don't do anything. */ if (th->p_joining != NULL) { - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); return 0; } /* Mark as detached */ th->p_detached = 1; terminated = th->p_terminated; - release(&handle->h_spinlock); + __pthread_unlock(&handle->h_lock); /* If already terminated, notify thread manager to reclaim resources */ if (terminated && __pthread_manager_request >= 0) { request.req_thread = thread_self(); |