diff options
author | mtm <mtm@FreeBSD.org> | 2003-06-29 23:51:04 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-06-29 23:51:04 +0000 |
commit | 7f75cc45e943577f1bfd1324bb39e212b9531d54 (patch) | |
tree | e9bf941cb7bc23c1c5b2341a239af1a9b41cf044 /lib/libthr/thread/thr_join.c | |
parent | 39a4899732da552e6e0de76201566ee295c841fc (diff) | |
download | FreeBSD-src-7f75cc45e943577f1bfd1324bb39e212b9531d54.zip FreeBSD-src-7f75cc45e943577f1bfd1324bb39e212b9531d54.tar.gz |
Sweep through pthread locking and use the new locking primitives for
libthr.
Diffstat (limited to 'lib/libthr/thread/thr_join.c')
-rw-r--r-- | lib/libthr/thread/thr_join.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c index 2a5433a..8b57978 100644 --- a/lib/libthr/thread/thr_join.c +++ b/lib/libthr/thread/thr_join.c @@ -33,6 +33,7 @@ */ #include <errno.h> #include <pthread.h> +#include <stdlib.h> #include "thr_private.h" __weak_reference(_pthread_join, pthread_join); @@ -69,7 +70,7 @@ _pthread_join(pthread_t pthread, void **thread_return) THREAD_LIST_LOCK; TAILQ_FOREACH(thread, &_thread_list, tle) if (thread == pthread) { - _SPINLOCK(&pthread->lock); + THR_LOCK(&pthread->lock); break; } @@ -79,7 +80,7 @@ _pthread_join(pthread_t pthread, void **thread_return) */ TAILQ_FOREACH(thread, &_dead_list, dle) if (thread == pthread) { - _SPINLOCK(&pthread->lock); + THR_LOCK(&pthread->lock); break; } @@ -87,7 +88,7 @@ _pthread_join(pthread_t pthread, void **thread_return) if (thread == NULL || ((pthread->attr.flags & PTHREAD_DETACHED) != 0)) { if (thread != NULL) - _SPINUNLOCK(&pthread->lock); + THR_UNLOCK(&pthread->lock); THREAD_LIST_UNLOCK; DEAD_LIST_UNLOCK; ret = ESRCH; @@ -97,7 +98,7 @@ _pthread_join(pthread_t pthread, void **thread_return) if (pthread->joiner != NULL) { /* Multiple joiners are not supported. */ /* XXXTHR - support multiple joiners. */ - _SPINUNLOCK(&pthread->lock); + THR_UNLOCK(&pthread->lock); THREAD_LIST_UNLOCK; DEAD_LIST_UNLOCK; ret = ENOTSUP; @@ -109,7 +110,7 @@ _pthread_join(pthread_t pthread, void **thread_return) if (pthread->state != PS_DEAD) { /* Set the running thread to be the joiner: */ pthread->joiner = curthread; - _SPINUNLOCK(&pthread->lock); + THR_UNLOCK(&pthread->lock); _thread_critical_enter(curthread); /* Keep track of which thread we're joining to: */ @@ -159,7 +160,7 @@ _pthread_join(pthread_t pthread, void **thread_return) /* Make the thread collectable by the garbage collector. */ pthread->attr.flags |= PTHREAD_DETACHED; - _SPINUNLOCK(&pthread->lock); + THR_UNLOCK(&pthread->lock); THREAD_LIST_UNLOCK; if (pthread_cond_signal(&_gc_cond) != 0) PANIC("Cannot signal gc cond"); |