diff options
author | davidxu <davidxu@FreeBSD.org> | 2005-10-26 07:11:43 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2005-10-26 07:11:43 +0000 |
commit | 092974700594d831ce82e7ffa941f312151f3ef9 (patch) | |
tree | f4146bc116dab4bc6b914fbaa89a58e3a7ae8e35 /lib/libthr/thread/thr_join.c | |
parent | 23ec020060d0889d45cd07e2d8f578498aeab4c0 (diff) | |
download | FreeBSD-src-092974700594d831ce82e7ffa941f312151f3ef9.zip FreeBSD-src-092974700594d831ce82e7ffa941f312151f3ef9.tar.gz |
Follow the change in kernel, joiner thread just waits at thread id
address, let kernel wake it up.
Diffstat (limited to 'lib/libthr/thread/thr_join.c')
-rw-r--r-- | lib/libthr/thread/thr_join.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c index 81c210d..e63a387 100644 --- a/lib/libthr/thread/thr_join.c +++ b/lib/libthr/thread/thr_join.c @@ -76,10 +76,10 @@ join_common(pthread_t pthread, void **thread_return, struct pthread *curthread = _get_curthread(); struct timespec ts, ts2, *tsp; void *tmp; - long state; + long tid; int oldcancel; int ret = 0; - + if (pthread == NULL) return (EINVAL); @@ -107,7 +107,8 @@ join_common(pthread_t pthread, void **thread_return, THR_CLEANUP_PUSH(curthread, backout_join, pthread); oldcancel = _thr_cancel_enter(curthread); - while ((state = pthread->state) != PS_DEAD) { + tid = pthread->tid; + while (pthread->tid != TID_TERMINATED) { if (abstime != NULL) { clock_gettime(CLOCK_REALTIME, &ts); TIMESPEC_SUB(&ts2, abstime, &ts); @@ -118,7 +119,7 @@ join_common(pthread_t pthread, void **thread_return, tsp = &ts2; } else tsp = NULL; - ret = _thr_umtx_wait(&pthread->state, state, tsp); + ret = _thr_umtx_wait(&pthread->tid, tid, tsp); if (ret == ETIMEDOUT) break; } |