Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2006-09-20 08:58:36


Alexander Terekhov <terekhov_at_[hidden]> writes:

> 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.

I currently haven't thought about destruction much. This is an important
issue, so thanks for raising it. I'll post afresh when I've got a solution.

Anthony

-- 
Anthony Williams
Software Developer
Just Software Solutions Ltd
http://www.justsoftwaresolutions.co.uk

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk