Subj : Re: Real cause of spurius wakeups To : comp.programming.threads From : Alexander Terekhov Date : Thu Mar 31 2005 07:19 pm Vladimir Prus wrote: > > Hello, > > can somebody explain the real reason why spurious wakeups are possible. That > is, why call to pthread_cond_wait can return without > pthread_cond_broadcast/pthread_cond_signal. Because apart from realtime scheduling, pthread_cond_broadcast/pthread_cond_signal can be implemented as nop. No kidding. cond_wait: mutex::release_guard guard(mutex); sleep(random()); cond_signal: nop cond_broadcast: nop See also http://terekhov.de/DESIGN-futex-CV.cpp http://terekhov.de/DESIGN-futex-CV-with-async.cancelable-wait.txt regards, alexander. .