Bug#651005: /usr/share/man/man3/pthread_cond_wait.3.gz: pthread_cond_wait documentation incorrect, does not allow for spurious wakeups
control: reassign -1 651005 manpages-dev
Hi,
On 2011-12-04 18:33, Nikolaus Rath wrote:
> Package: glibc-doc
> Version: 2.13-21
> Severity: normal
> File: /usr/share/man/man3/pthread_cond_wait.3.gz
> Tags: patch
>
> pthread_cond_wait(3) says:
>
> pthread_cond_wait atomically unlocks the mutex (as per
> pthread_unlock_mutex) and waits for the condition variable
> cond to be signaled. The thread execution is suspended and does
> not consume any CPU time until the condition variable is
> signaled. The mutex must be locked by the calling thread on
> entrance to pthread_cond_wait. Before returning to the calling
> thread, pthread_cond_wait re-acquires mutex (as per
> pthread_lock_mutex).
>
> This is actually not true in practice, and also not required by POSIX.
> pthread_cond_wait() sometimes wakes up without the condition variable
> having been signaled, and POSIX allows for such "spurious wakeups".
>
> See also
>
> http://en.wikipedia.org/wiki/Spurious_wakeup
> http://stackoverflow.com/questions/8378789/forcing-a-thread-context-switch
>
> Suggested patch:
>
> pthread_cond_wait atomically unlocks the mutex (as per
> pthread_unlock_mutex) and waits for the condition variable
> cond to be signaled. The thread execution is suspended and does
> not consume any CPU time until woken up. The thread will be woken
> up when the condition variable is signaled, but spurious wakeups
> without a corresponding signal may also happen. The mutex must
> be locked by the calling thread on entrance to
> pthread_cond_wait. Before returning to the calling thread,
> pthread_cond_wait re-acquires mutex (as per pthread_lock_mutex).
The pthread_cond_wait(3) manpage got moved to the manpages-dev package,
I am therefore reassigning the bug accordingly.
Regards
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
Reply to: