Simplify code by replacing _thr_ref_add() with _thr_find_thread().

This commit is contained in:
David Xu 2012-07-20 03:37:19 +00:00
parent 340e384de9
commit ec225efc58

View File

@ -51,16 +51,12 @@ _pthread_set_name_np(pthread_t thread, const char *name)
if (thr_set_name(thread->tid, name)) if (thr_set_name(thread->tid, name))
ret = errno; ret = errno;
} else { } else {
if (_thr_ref_add(curthread, thread, 0) == 0) { if ((ret=_thr_find_thread(curthread, thread, 0)) == 0) {
THR_THREAD_LOCK(curthread, thread);
if (thread->state != PS_DEAD) { if (thread->state != PS_DEAD) {
if (thr_set_name(thread->tid, name)) if (thr_set_name(thread->tid, name))
ret = errno; ret = errno;
} }
THR_THREAD_UNLOCK(curthread, thread); THR_THREAD_UNLOCK(curthread, thread);
_thr_ref_delete(curthread, thread);
} else {
ret = ESRCH;
} }
} }
#if 0 #if 0