Peter Dimov wrote:
You are not the first to assume that spurious wakeups represent a deficiency in the POSIX specification and that it would have been better without them, but this is not true, at least in principle. (Pragmatically speaking, without spurious wakeups, incorrect code fails less often, sometimes "never" for practical purposes. But... well.)
My experience of this was with signals, e.g. sigtimer, on Linux; a library that I was trying to use worked fine until I had a timer firing 50 times each second, which caused spurious wakeups in the futex syscall. This took a ridiculously long time to debug. It would actually be worthwhile to have a debug condvar implementation that would deliberately wakeup "spuriously" with some probability. That could even be a useful addition to Boost, if someone wanted to write it. Regards, Phil.