diff options
author | mtm <mtm@FreeBSD.org> | 2004-04-19 14:20:01 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-04-19 14:20:01 +0000 |
commit | 023ebd18f8bb90d8caa00ad6d5e5625a4fed26e0 (patch) | |
tree | 2251d9cc53071ecbb7487236751ae6a97afabf2c | |
parent | 71a08a6316fb8217a5364ad64f88d1bb64703bd3 (diff) | |
download | FreeBSD-src-023ebd18f8bb90d8caa00ad6d5e5625a4fed26e0.zip FreeBSD-src-023ebd18f8bb90d8caa00ad6d5e5625a4fed26e0.tar.gz |
If you're trying to find out if a thread is valid and in
the same process as the current thread it makes absolutely
no sense to lock the parent process through the pointer in
said thread.
Submitted by: pho (with minor correction)
Pointy Hat To: mtm
-rw-r--r-- | sys/kern/kern_thr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index 6e70322..4d1182b 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -297,19 +297,19 @@ thr_wake(struct thread *td, struct thr_wake_args *uap) struct thread *tdsleeper, *ttd; tdsleeper = ((struct thread *)uap->id); - PROC_LOCK(tdsleeper->td_proc); - FOREACH_THREAD_IN_PROC(tdsleeper->td_proc, ttd) { + PROC_LOCK(td->td_proc); + FOREACH_THREAD_IN_PROC(td->td_proc, ttd) { if (ttd == tdsleeper) break; } if (ttd == NULL) { - PROC_UNLOCK(tdsleeper->td_proc); + PROC_UNLOCK(td->td_proc); return (ESRCH); } mtx_lock_spin(&sched_lock); tdsleeper->td_flags |= TDF_THRWAKEUP; mtx_unlock_spin(&sched_lock); wakeup_one((void *)tdsleeper); - PROC_UNLOCK(tdsleeper->td_proc); + PROC_UNLOCK(td->td_proc); return (0); } |