Jonas Maebe wrote:
By implication this means you need a mutex to protect against race conditions.

Not necessarily, it is at least possible to implement an atomic linked list without requiring a mutex-style lock.

That's irrelevant. If thread 1 lets thread 2 do something, and thread 2 would signal thread 1 after completion, then thread 1 might not have started to wait yet (descheduled just before cond_wait). Could happen for example with TThread.Synchronize.

Windows events do not have this problem since they are stateful. In hindsight, a semaphore might have been a better emulation of an 'Event' (although I've not thought this through completely), but at the time condition variables seemed to be the logical way to go.

Micha
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to