Use function tdfind() to find a thread.
This commit is contained in:
parent
b4fee3c1ed
commit
bc55e49455
@ -416,19 +416,10 @@ cpuset_which(cpuwhich_t which, id_t id, struct proc **pp, struct thread **tdp,
|
|||||||
td = curthread;
|
td = curthread;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sx_slock(&allproc_lock);
|
td = tdfind(id, -1);
|
||||||
FOREACH_PROC_IN_SYSTEM(p) {
|
|
||||||
PROC_LOCK(p);
|
|
||||||
FOREACH_THREAD_IN_PROC(p, td)
|
|
||||||
if (td->td_tid == id)
|
|
||||||
break;
|
|
||||||
if (td != NULL)
|
|
||||||
break;
|
|
||||||
PROC_UNLOCK(p);
|
|
||||||
}
|
|
||||||
sx_sunlock(&allproc_lock);
|
|
||||||
if (td == NULL)
|
if (td == NULL)
|
||||||
return (ESRCH);
|
return (ESRCH);
|
||||||
|
p = td->td_proc;
|
||||||
break;
|
break;
|
||||||
case CPU_WHICH_CPUSET:
|
case CPU_WHICH_CPUSET:
|
||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user