If a thread who's name is being set is not the current thread, use macros

THR_THREAD_LOCK and THR_THREAD_UNLOCK instead, this should fix wrong
lock level problem.

Bug reported by: ed dot maste at gmail dot com
This commit is contained in:
David Xu 2007-04-05 07:20:31 +00:00
parent 8c338614ac
commit 6839e793cf

View File

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