Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Oct 2009 17:00:53 +0000
From:      Tom Judge <tom@tomjudge.com>
To:        freebsd-hackers@freebsd.org
Subject:   Kernel Thread Lock Question
Message-ID:  <4ACA2645.30801@tomjudge.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ACA2645.30801>