Hi all
I'm designing a multithreaded application which has long running threads. I need to check some condititons in the main thread, interrupt the threads and end the program if the conditions are true. But i'm not sure if this is the correct/safest way. Here's my pseudo:
main()
{
boost::thread t1(f1);
boost::thread t2(f2);
//while (1)
//{
//check for some conditions
//if (condition1)
//{
// t1.interrupt();
// t2.interrupt();
//}
//}
t1.join();
t2.join();
}
if the main thread runs the while loop, the threads t1,t2 will not join never. So is this safe? or what can i do else?
thanks in advance.