Unfortunately, I don't have access to the newer versions boost - only 1.33. Basically, I would like to do the following:
void threadFunc() {
while (true) {
{
getALock();
doWork();
}
// sleep for x unless signaled to wake up or boolean changed to
// stop doing work.
if (toldToExit()) return;
}
}
The main thread would start up the thread, let it do work for an infinite amount of time and then eventually, tell the to stop doing work and die. The only problem is that I want the thread to wake-up immediately after the main thread tells it to stop. Like I said, I only have what is available in boost 1.33. How can I achieve the above? If possible, I'd rather avoid using pthreads.