Short-circuit tdfind when looking for the calling thread.
Common occurence with cpuset and other places.
This commit is contained in:
parent
1bd12a3bb2
commit
7cd4443fb1
@ -1299,6 +1299,14 @@ tdfind(lwpid_t tid, pid_t pid)
|
||||
struct thread *td;
|
||||
int run = 0;
|
||||
|
||||
td = curthread;
|
||||
if (td->td_tid == tid) {
|
||||
if (pid != -1 && td->td_proc->p_pid != pid)
|
||||
return (NULL);
|
||||
PROC_LOCK(td->td_proc);
|
||||
return (td);
|
||||
}
|
||||
|
||||
rw_rlock(&tidhash_lock);
|
||||
LIST_FOREACH(td, TIDHASH(tid), td_hash) {
|
||||
if (td->td_tid == tid) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user