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
This commit is contained in:
David Xu 2012-07-20 01:56:14 +00:00
parent 42420dccd5
commit 12dbbf86f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238637

View File

@ -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);
}