summaryrefslogtreecommitdiff
path: root/lib/libkse/thread/thr_find_thread.c
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2003-07-17 23:02:30 +0000
committerDavid Xu <davidxu@FreeBSD.org>2003-07-17 23:02:30 +0000
commit090b336154a0d8570ea8fad84e60e7d49aa801e7 (patch)
tree501dc66c4a1aec9b0ce29190b9613a1163a1f18a /lib/libkse/thread/thr_find_thread.c
parent3074d1b454e37e25facad76e56d2a05317f9e751 (diff)
Notes
Diffstat (limited to 'lib/libkse/thread/thr_find_thread.c')
-rw-r--r--lib/libkse/thread/thr_find_thread.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/libkse/thread/thr_find_thread.c b/lib/libkse/thread/thr_find_thread.c
index ef469d94d2ada..e8d9fcbd3e4d1 100644
--- a/lib/libkse/thread/thr_find_thread.c
+++ b/lib/libkse/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);