thread scheduling at mutex unlock
Andrew Snow
andrew at modulus.org
Thu May 15 20:51:14 UTC 2008
> 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
More information about the freebsd-stable
mailing list