> I was about to respond with something like, "that's crazy, of course
> the waiting thread will get the lock." Then I asked Google. This
> discussion is on point:
> http://www.mail-archive.com/linux-il@cs.huji.ac.il/msg48835.html
> Seems that the POSIX spec says that fairness in mutex acquisition is
> optional, and that the Linux implementation doesn't guarantee it,
> especially in tight lock/unlock loops. That was certainly news to
> me, and I'm sure that I've written code in the past that assumed mutex
> fairness.
I was pretty sure there was no fairness requirement, but did not know
(and was too lazy to check) what Linux does. Thanks for digging it up.