Date: Fri, 16 May 2008 06:51:01 +1000 From: Andrew Snow <andrew@modulus.org> To: freebsd-stable@freebsd.org Subject: Re: thread scheduling at mutex unlock Message-ID: <482CA235.6090400@modulus.org> In-Reply-To: <MDEHLPKNGKAHNMBLJOLKAEKPMKAC.davids@webmaster.com> References: <MDEHLPKNGKAHNMBLJOLKAEKPMKAC.davids@webmaster.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> But I think that it is not "fair" that at re-lock former > owner gets the lock immediately and the thread that waited on it for > longer time doesn't get a chance. I believe this is what yield() is for. Before attempting a re-lock you should call yield() to allow other threads a chance to run. (Side note: On FreeBSD, I believe only high priority threads will run when you yield(). As a workaround, I think you have to lower the thread's priority before yield() and then raise it again afterwards.) - Andrew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?482CA235.6090400>