The Wikipedia article on spurious wakeups has this tidbit:
The
pthread_cond_wait()
function in Linux is implemented using thefutex
system call. Each blocking system call on Linux returns abruptly withEINTR
when the process receives a signal. …pthread_cond_wait()
can’t restart the waiting because it may miss a real wakeup in the little time it was outside thefutex
system call. This race condition can only be avoided by the caller checking for an invariant. A POSIX signal will therefore generate a spurious wakeup.
Summary: If a Linux process is signaled its waiting threads will each enjoy a nice, hot spurious wakeup.
I buy it. That’s an easier pill to swallow than the typically vague “it’s for performance” reason often given.