[PATCH] client: clarify wl_display_prepare_read() semantics
Bill Spitzak
spitzak at gmail.com
Thu Sep 4 18:58:55 PDT 2014
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).
More information about the wayland-devel
mailing list