
Hi All I am playing with boost::thread and it is not clear how thread::interrupt actually works. If I understood clearly the thread will be interrupted the next time it enters one of the predefined *interruption points*http://www.boost.org/doc/libs/1_43_0/doc/html/thread/thread_management.html#...; since thread::join is one interruption point, after I call tr.interrupt() I am expected that the thread will throw a boost::thread_interrupted exception once I call tr.join() right? . Below the sample code I am working now and I cannot get this behavior. Maybe I misunderstood the meaning of interrupt. If I uncomment the call to this_thread::sleep() I can see the thread_interrupted exception. Can you help me in understanding? Regards void f1_good(){ try{ int i = 0; while(true){ i++; // boost::this_thread::sleep( boost::posix_time::milliseconds( 0 ) ); // if I // uncomment this line calling interrupt will throw thread_interrupted } }catch(boost::thread_interrupted& ex ){ std::cout << "BREAK HERE!!" << std::endl; std::cout.flush(); } } int main( int argc, char** argv ){ boost::thread tr( f1 ); boost::this_thread::sleep( boost::posix_time::seconds( 3 ) ); std::cout << "calisl to INTER." << std::endl; std::cout.flush(); tr.interrupt(); std::cout << "PAUSE BEFORE JOIN." << std::endl; std::cout.flush(); boost::this_thread::sleep( boost::posix_time::seconds( 5 ) ); std::cout << "join" << std::endl; tr.join(); }