On 08/28/2014 08:52 AM, Pekka Paalanen wrote:
The manual I could find: http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cond_wait.html says that spurious wakeups may occur. So better keep the serial there.
Yes indeed. I believe it is valid, and even common, for pthread_cond_wait to just unlock, yield, and lock the mutex and return immediately, at least for a short period of time. Setting up a block would add a lot of overhead, and even looping and checking a variable would add unnecessary overhead in the common (and required, I guess) case that the client is checking some other variable as well.
On Windows we used a replacement version of pthread that was faster than the official ones, one of the hacks was that this would always return after .001 second. The overhead of doing this is much less than building a proper atomic api atop Windows conditions (this may have been fixed in newer Windows, this was NT).
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel