diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-07-17 23:02:30 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-07-17 23:02:30 +0000 |
commit | 8cbb5ce67318a92b9504e120b732fb3b549c6023 (patch) | |
tree | 501dc66c4a1aec9b0ce29190b9613a1163a1f18a /lib/libpthread/thread/thr_find_thread.c | |
parent | 97d2d9dfed7fc1f9fa26e38c42c4de810d167012 (diff) | |
download | FreeBSD-src-8cbb5ce67318a92b9504e120b732fb3b549c6023.zip FreeBSD-src-8cbb5ce67318a92b9504e120b732fb3b549c6023.tar.gz |
o Eliminate upcall for PTHREAD_SYSTEM_SCOPE thread, now it
is system bound thread and when it is blocked, no upcall is generated.
o Add ability to libkse to allow it run in pure 1:1 threading mode,
defining SYSTEM_SCOPE_ONLY in Makefile can turn on this option.
o Eliminate code for installing dummy signal handler for sigwait call.
o Add hash table to find thread.
Reviewed by: deischen
Diffstat (limited to 'lib/libpthread/thread/thr_find_thread.c')
-rw-r--r-- | lib/libpthread/thread/thr_find_thread.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/libpthread/thread/thr_find_thread.c b/lib/libpthread/thread/thr_find_thread.c index ef469d9..e8d9fcb 100644 --- a/lib/libpthread/thread/thr_find_thread.c +++ b/lib/libpthread/thread/thr_find_thread.c @@ -56,19 +56,17 @@ _thr_ref_add(struct pthread *curthread, struct pthread *thread, crit = _kse_critical_enter(); curkse = _get_curkse(); KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); - TAILQ_FOREACH(pthread, &_thread_list, tle) { - if (pthread == thread) { - if ((include_dead == 0) && - ((pthread->state == PS_DEAD) || - ((pthread->state == PS_DEADLOCK) || - ((pthread->flags & THR_FLAGS_EXITING) != 0)))) - pthread = NULL; - else { - thread->refcount++; - if (curthread != NULL) - curthread->critical_count++; - } - break; + pthread = _thr_hash_find(thread); + if (pthread) { + if ((include_dead == 0) && + ((pthread->state == PS_DEAD) || + ((pthread->state == PS_DEADLOCK) || + ((pthread->flags & THR_FLAGS_EXITING) != 0)))) + pthread = NULL; + else { + pthread->refcount++; + if (curthread != NULL) + curthread->critical_count++; } } KSE_LOCK_RELEASE(curkse, &_thread_list_lock); |