Kernel Thread Lock Question
Julian Elischer
julian at elischer.org
Mon Oct 5 17:55:26 UTC 2009
Tom Judge wrote:
> 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);
>
"probably not" because the value in the status word can change just
after you release it anyhow so your result does not have to be
consistent with anything, just with itself.
>
> Thanks
>
> Tom
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
More information about the freebsd-hackers
mailing list