Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2006-09-20 08:36:19

Anthony Williams wrote:
> // Any APC will break the sleep, so keep sleeping until we've been
> // notified, or we've timed out
> while(!atomic_read(new_node.notified)
> && SleepEx(milliseconds_until(timeout), true)==WAIT_IO_COMPLETION);
> lock(gate)

(generally, access *this after waiting without any sync with dtor)

The gate being just a mutex (in 8a the gate is a semaphore
unlocked/posted by last exiting waiter in the case of no-NOP
signaling). You've got a problem here regarding POSIX safety with
respect to CV destruction. POSIX says that it "shall be safe to
destroy an initialized condition variable upon which no threads are
currently blocked" and even gives an example illustrating it using
broadcast() followed by destroy(). 8a handles it by synchronizing
with exiting waiters on a gate semaphore in CV dtor.


Boost list run by bdawes at, gregod at, cpdaniel at, john at