Re: How to wait for multiple threads simultaneously?



David Schwartz <davids@xxxxxxxxxxxxx> writes:
On Feb 13, 1:51 am, Rainer Weikusat <rweiku...@xxxxxxxxxxx> wrote:

You can then spin on that condition variable.

To 'spin' on some lock would mean to busy-wait until it is free, eg

while (try_to_take(&lock) == FAILED);

Right, but a condition variable is not a lock. To 'spin' on a
condition variable means to block on it until the predicate occurs,
like

A 'spin lock' is one which does not involve blocking, but
busy-waiting. 'Condition variables' are something threads can block
on, hence, they don't "spin" on them. That blocking on pthread cond
vars may result in spurious wakeups is an accidental property of them.
The normal use is till to block on the condition variable until it is
signaled.

The verb itself describes a continous, fast activity. IMO, it's just
potentially confusing to use it for something completely different
(occasional retesting of a condition).

.