Main thread could just create Event
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