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;
|
||||
break;
|
||||
}
|
||||
sx_slock(&allproc_lock);
|
||||
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);
|
||||
td = tdfind(id, -1);
|
||||
if (td == NULL)
|
||||
return (ESRCH);
|
||||
p = td->td_proc;
|
||||
break;
|
||||
case CPU_WHICH_CPUSET:
|
||||
if (id == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user