mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-29 12:03:03 +00:00
Eliminate duplicated code.
This commit is contained in:
parent
ef80e034bb
commit
7e0cf81bc9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238640
@ -54,39 +54,25 @@ _pthread_setschedparam(pthread_t pthread, int policy,
|
||||
int ret;
|
||||
|
||||
if (pthread == curthread) {
|
||||
pthread = curthread;
|
||||
THR_LOCK(curthread);
|
||||
if (curthread->attr.sched_policy == policy &&
|
||||
(policy == SCHED_OTHER ||
|
||||
curthread->attr.prio == param->sched_priority)) {
|
||||
pthread->attr.prio = param->sched_priority;
|
||||
THR_UNLOCK(curthread);
|
||||
return (0);
|
||||
}
|
||||
ret = _thr_setscheduler(curthread->tid, policy, param);
|
||||
if (ret == -1)
|
||||
ret = errno;
|
||||
else {
|
||||
curthread->attr.sched_policy = policy;
|
||||
curthread->attr.prio = param->sched_priority;
|
||||
}
|
||||
THR_UNLOCK(curthread);
|
||||
} 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)) {
|
||||
pthread->attr.prio = param->sched_priority;
|
||||
THR_THREAD_UNLOCK(curthread, pthread);
|
||||
return (0);
|
||||
}
|
||||
ret = _thr_setscheduler(pthread->tid, policy, param);
|
||||
if (ret == -1)
|
||||
ret = errno;
|
||||
else {
|
||||
pthread->attr.sched_policy = policy;
|
||||
pthread->attr.prio = param->sched_priority;
|
||||
}
|
||||
/*include dead*/0)) != 0)
|
||||
return (ret);
|
||||
if (pthread->attr.sched_policy == policy &&
|
||||
(policy == SCHED_OTHER ||
|
||||
pthread->attr.prio == param->sched_priority)) {
|
||||
pthread->attr.prio = param->sched_priority;
|
||||
THR_THREAD_UNLOCK(curthread, pthread);
|
||||
return (0);
|
||||
}
|
||||
ret = _thr_setscheduler(pthread->tid, policy, param);
|
||||
if (ret == -1)
|
||||
ret = errno;
|
||||
else {
|
||||
pthread->attr.sched_policy = policy;
|
||||
pthread->attr.prio = param->sched_priority;
|
||||
}
|
||||
THR_THREAD_UNLOCK(curthread, pthread);
|
||||
return (ret);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user