tags:

views:

112

answers:

2

Child threads sleeps to wait condition, and the parent thread can call some routine to wake up all child threads to run?

+3  A: 

If you're using POSIX threads (pthreads), then pthread_cond_wait and (in your case) pthread_cond_broadcast are your friends. :-)

Chris Jester-Young
+2  A: 

If you are using Win32, then you can use a manual-reset Event. Your parent thread would call SetEvent() and could wake up all child threads waiting for that object with a function such as WaitForSingleObject().

Greg Hewgill