diff options
author | David Leonard <d@cvs.openbsd.org> | 1998-11-09 03:13:22 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1998-11-09 03:13:22 +0000 |
commit | ff47464de5e68e9c49fe312c953f54b2e90f546c (patch) | |
tree | 4ec0e7f13d619e1b5bf6abfd7125a4ec17569568 /lib/libc_r/uthread/uthread_find_thread.c | |
parent | 1b2b2c2386c6cc5ebffc769b8a39b80d47e4e0d0 (diff) |
sync with FreeBSD (rwlock, gc thread, man pages)
add (broken) mips md stuff
fix some const warnings
add sigaltstack() stub
another hash at getting shlib auto-init to work (mips/elf and i386/a.out)
Diffstat (limited to 'lib/libc_r/uthread/uthread_find_thread.c')
-rw-r--r-- | lib/libc_r/uthread/uthread_find_thread.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/libc_r/uthread/uthread_find_thread.c b/lib/libc_r/uthread/uthread_find_thread.c index 99e302306d2..e4a59a0d83f 100644 --- a/lib/libc_r/uthread/uthread_find_thread.c +++ b/lib/libc_r/uthread/uthread_find_thread.c @@ -76,8 +76,12 @@ _find_dead_thread(pthread_t pthread) /* Invalid thread: */ return(EINVAL); - /* Lock the dead thread list: */ - _lock_dead_thread_list(); + /* + * Lock the garbage collector mutex to ensure that the garbage + * collector is not using the dead thread list. + */ + if (pthread_mutex_lock(&_gc_mutex) != 0) + PANIC("Cannot lock gc mutex"); /* Point to the first thread in the list: */ pthread1 = _thread_dead; @@ -85,11 +89,12 @@ _find_dead_thread(pthread_t pthread) /* Search for the thread to join to: */ while (pthread1 != NULL && pthread1 != pthread) { /* Point to the next thread: */ - pthread1 = pthread1->nxt; + pthread1 = pthread1->nxt_dead; } - /* Unlock the dead thread list: */ - _unlock_dead_thread_list(); + /* Unlock the garbage collector mutex: */ + if (pthread_mutex_unlock(&_gc_mutex) != 0) + PANIC("Cannot lock gc mutex"); /* Return zero if the thread exists: */ return ((pthread1 != NULL) ? 0:ESRCH); |