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 
|  /       \ [EMAIL PROTECTED]     +------>x   USA    \ a very strange
| (   OZ    )                                \___   ___ | country !
+- X_.---._/    presently in San Francisco       \_/   \\
          v

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to