From 12dbbf86f8459d35f2b4652e4c4136c22f44ed31 Mon Sep 17 00:00:00 2001 From: David Xu Date: Fri, 20 Jul 2012 01:56:14 +0000 Subject: [PATCH] Don't forget to release a thread reference count, replace _thr_ref_add() with _thr_find_thread(), so reference count is no longer needed. MFC after: 3 days --- lib/libthr/thread/thr_setschedparam.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/libthr/thread/thr_setschedparam.c b/lib/libthr/thread/thr_setschedparam.c index 59d62dcda1ef..a8a15d1a92ef 100644 --- a/lib/libthr/thread/thr_setschedparam.c +++ b/lib/libthr/thread/thr_setschedparam.c @@ -70,9 +70,8 @@ _pthread_setschedparam(pthread_t pthread, int policy, curthread->attr.prio = param->sched_priority; } THR_UNLOCK(curthread); - } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) - == 0) { - THR_THREAD_LOCK(curthread, pthread); + } else if ((ret = _thr_find_thread(curthread, pthread, + /*include dead*/0)) == 0) { if (pthread->attr.sched_policy == policy && (policy == SCHED_OTHER || pthread->attr.prio == param->sched_priority)) { @@ -88,7 +87,6 @@ _pthread_setschedparam(pthread_t pthread, int policy, pthread->attr.prio = param->sched_priority; } THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); } return (ret); }