From ec225efc588a1807f8409541d07c144621cb12fd Mon Sep 17 00:00:00 2001 From: David Xu Date: Fri, 20 Jul 2012 03:37:19 +0000 Subject: [PATCH] Simplify code by replacing _thr_ref_add() with _thr_find_thread(). --- lib/libthr/thread/thr_info.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/libthr/thread/thr_info.c b/lib/libthr/thread/thr_info.c index 2da6da2f187e..350c8481c41c 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