Date: Fri, 20 Jul 2001 08:57:23 -0700 From: Julian Elischer <julian@elischer.org> To: current@freebsd.org Subject: huh? in Selrecord(): what is this for? Message-ID: <3B5854E3.B6D9C86D@elischer.org>
next in thread | raw e-mail | index | archive | help
void selrecord(selector, sip) struct proc *selector; struct selinfo *sip; { struct proc *p; pid_t mypid; mypid = selector->p_pid; if (sip->si_pid == mypid) return; if (sip->si_pid && (p = pfind(sip->si_pid))) { Why do we look up 'p' when we got it as an argument? (race condition detection?) (I'm modifying things for threads so I came up against this....) mtx_lock_spin(&sched_lock); if (p->p_wchan == (caddr_t)&selwait) { mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); sip->si_flags |= SI_COLL; return; } mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); } sip->si_pid = mypid; } -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B5854E3.B6D9C86D>