Main thread could just create Event
Originally Posted by grumpy
and start waiting on this event
when child thread does its work it sets the event
and main thread exits the wait and starts reading file or something. no need in polling in this case
in the OP code main thread could start waiting on the mutex which is not created yet
Yeah, indeed. There are all sorts of ways.
Originally Posted by vart
The basic concern, however, is that radeberger is relying on one thread completing some action before another thread grabs the mutex. But doing nothing that ensures that sequence of events actually occurs. These things don't happen by magic.