Child threads sleeps to wait condition, and the parent thread can call some routine to wake up all child threads to run?
views:
112answers:
2
+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
2009-06-03 03:26:04
+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
2009-06-03 03:32:02