Date: Sun, 27 Feb 2011 12:54:44 -0800 From: Yuri <yuri@rawbw.com> To: freebsd-hackers@freebsd.org Subject: Is pthread_cond_signal(3) man page correct? Message-ID: <4D6ABA14.80208@rawbw.com>
next in thread | raw e-mail | index | archive | help
On FreeBSD-8.1 this page says: The pthread_cond_signal() function unblocks one thread waiting for the condition variable cond. On Linux it says: The /pthread_cond_signal/() function shall unblock at least one of the threads that are blocked on the specified condition variable /cond/ (if any threads are blocked on /cond/). Also HP page (http://docs.hp.com/en/B2355-90130/pthread_cond_signal.3T.html) says: "If there are no threads blocked on /cond/, this function has no effect." And later it says: "It is possible that more than one thread can be unblocked due to a spurious wakeup." This is quite confusing: in case nobody is waiting does it block or not? In case other threads are waiting it's really "any arbitrary number of threads are woken up"? Or on FreeBSD it's strictly 1? Shouldn't this be defined in one and only way by POSIX and all POSIX-compliant systems should work exactly the same. I think man page should be expanded to give more comprehensive explanation. Yuri
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D6ABA14.80208>