
Peter Dimov wrote:
A timed out waiter can only steal a wakeup if the condition variable has been signal()ed. If it were broadcast()ed, there's no problem, as everyone is woken up and there's nothing to steal.
Sure, but only if all threads are waiting for the same predicate. The ones, that wait on a different see this wakeup as a spurious wakeup. From Butenhof: "There's nothing wrong with doing either (share one condition with multiple predicates or several conditions for a single predicate), as long as you're careful ... First, when you share a condition variable between multiple predicates, you must always broadcast, never signal." Since in our templated convenience wrapper we cannot know how much predicates indeed are associated, we must play safe, and broadcast. Roland