summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2012-07-20 03:37:19 +0000
committerdavidxu <davidxu@FreeBSD.org>2012-07-20 03:37:19 +0000
commit617731748280d2efa18842ecd83573892a9d73e3 (patch)
tree180d99213a34c39ae726c1921efb2373c7b63c01 /lib/libthr
parent298769009da2d2356405a4415808b404e7c7d234 (diff)
downloadFreeBSD-src-617731748280d2efa18842ecd83573892a9d73e3.zip
FreeBSD-src-617731748280d2efa18842ecd83573892a9d73e3.tar.gz
Simplify code by replacing _thr_ref_add() with _thr_find_thread().
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_info.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_info.c b/lib/libthr/thread/thr_info.c
index 2da6da2..350c848 100644
--- a/lib/libthr/thread/thr_info.c
+++ b/lib/libthr/thread/thr_info.c
@@ -51,16 +51,12 @@ _pthread_set_name_np(pthread_t thread, const char *name)
if (thr_set_name(thread->tid, name))
ret = errno;
} else {
- if (_thr_ref_add(curthread, thread, 0) == 0) {
- THR_THREAD_LOCK(curthread, thread);
+ if ((ret=_thr_find_thread(curthread, thread, 0)) == 0) {
if (thread->state != PS_DEAD) {
if (thr_set_name(thread->tid, name))
ret = errno;
}
THR_THREAD_UNLOCK(curthread, thread);
- _thr_ref_delete(curthread, thread);
- } else {
- ret = ESRCH;
}
}
#if 0
OpenPOWER on IntegriCloud