Re: pthread_cond_wait spurious wakeup
- Reply: Dmitry Morozovsky : "Re: pthread_cond_wait spurious wakeup"
- In reply to: Slawa Olhovchenkov : "pthread_cond_wait spurious wakeup"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Jul 2026 23:41:49 UTC
On Sat, Jul 25, 2026 at 02:02:35AM +0300, Slawa Olhovchenkov wrote: > Is pthread_cond_wait susceptible to spurious wakeup in FreeBSD? The > pthread_cond_wait man page doesn't say anything about waiting thread > can unblocking in cases like EINTR. But in > lib/libthr/thread/thr_cond.c:232-249, > I seem to see a successful return from pthread_cond_wait on EINTR > case. So, we don't have a spurious wakeup issue, or does the man page > need to be corrected and an additional predicate should be used in > conjunction with pthread_cond_wait? Spurious wakeups are allowed and can happen. They are not neccessarly limited to signals delivery. 'The additional predicate' is how the user code must be structured anyway, because pthread_cond_wait() drops the mutex that is supposed to protect the data holding the condition.