
Matthias Vallentin
I am having issues with boost::thread::interrupt(). As far as I understood, calling this function will throw an exception in the corresponding thread. How can deal with blocking functions, such as a calls to accept() or when a thread is waiting on a condition variable to change? Basically the thread blocks somewhere in a while (true) loop.
Injecting interruption points manually with boost::this_thread::interruption_point() does not seem to help here either. boost::thread::interrupt() (or interrupt_all in a thread_group), simply does not return.
boost::thread::interrupt() calls the interrupted thread to throw an exception when it next reaches an interruption point with interruption enabled. Interruption points are boost::this_thread::sleep, boost::this_thread::interruption_point, boost::thread::join, boost::condition_variable::wait and timed_ variants. See http://www.justsoftwaresolutions.co.uk/threading/thread-interruption-in-boos... boost::thread::interrupt() should return almost immediately: it does not wait for the thread to be interrupted. Anthony -- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL