
Howard Hinnant <hinnant@twcny.rr.com> writes:
On Mar 27, 2007, at 4:21 AM, Anthony Williams wrote:
t.detach() t.join() harmless race. Either thread is detached first, so join is no-op, or thread is joined first, so detach is no-op.
This one has me worried as it seems like such a race is likely to be a logical error in the program.
Agreed. It just fell out from having detach, cancel and join be thread-safe. I agree that it is a bug to try and join and detach the same thread. join/join is always fine, though.
This is a departure from pthread semantics that I am uncomfortable with. If I accidently get myself into this kind of race. I think I'd prefer some noise (an assert, or exception, or crash).
Then we ought to specify the behaviour that we want rather than leaving it undefined. Anthony -- Anthony Williams Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL