Kernel Thread Lock Question

Tom Judge tom at tomjudge.com
Mon Oct 5 17:01:31 UTC 2009


Do I need to hold the per thread lock here? (This is for 7.1)

PROC_LOCK(p);
//mtx_lock_spin(&sched_lock);
breakout = 0;
FOREACH_THREAD_IN_PROC(p, td) {
    thread_lock(td);
    if (!TD_ON_RUNQ(td) &&
            !TD_IS_RUNNING(td) &&
            !TD_IS_SLEEPING(td)) {
        breakout = 1;
        thread_unlock(td);
        break;
    }
    thread_unlock(td);
}
//mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p);


Thanks

Tom


More information about the freebsd-hackers mailing list