How can I wake up the main thread (currently sleeping because of a sleep() function call) from inside a child thread (without the child thread terminating)?
I want to make my main thread wait for a signal from a child thread without using an infinite loop or anything else that eats CPU power.
The only things I found about this subject mentioned the main thread waking up a child thread but not the other way around.
If all you want to do is pause the thread until it receives a signal from another thread, that's exactly what the pause function is for.
pause() causes the calling process (or thread) to sleep until a signal is delivered that either terminates the process or causes the invocation of a signal-catching function.