
Roland Schwarz <roland.schwarz@chello.at> writes:
1) Is this corect code with respect to condition variable semantics (posix thread semantics?)
No. do_flag only signals one thread waiting on the condition. If this is one of the do_work threads, then it will wake up, go back to sleep, and the notification has been swallowed. Since the main thread didn't wake up, it won't break out of the loop checking global_flag. Since the only threads that do notification are the main thread and the do_flag thread, once all the threads have entered their waiting loop, if the do_flag notification wakes anyone other than the main thread, we have deadlock. Anthony -- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk