Date: Mon, 05 Oct 2009 10:55:27 -0700 From: Julian Elischer <julian@elischer.org> To: Tom Judge <tom@tomjudge.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Kernel Thread Lock Question Message-ID: <4ACA330F.7060207@elischer.org> In-Reply-To: <4ACA2645.30801@tomjudge.com> References: <4ACA2645.30801@tomjudge.com>
index | next in thread | previous in thread | raw e-mail
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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ACA330F.7060207>
