"Peter Dimov"
Anthony Williams: ...
void f() { barrier->wait(); }
int main(void) { barrier.reset(new boost::barrier(2)); boost::thread thread(boost::bind(&f)); barrier->wait();
At this point, there is no guarantee that f() has started.
Yes there is.
Doh! Thanks Peter, apparently I'm not thinking straight today. Anyway, there is no guarantee that the call to wait in f() has *completed*, which means it might still own the mutex in barrier, which means it is not safe to destroy the barrier at this point. Anthony -- Anthony Williams Author of C++ Concurrency in Action | http://www.manning.com/williams Custom Software Development | http://www.justsoftwaresolutions.co.uk Just Software Solutions Ltd, Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK