
On 06/08/10 14:55, Gaetano Mendola wrote:
On 07/26/2010 10:11 PM, Anthony Williams wrote:
However, in practice it is not. I am not aware of any platforms where I can cleanly catch a cancellation from pthread_cancel and translate it into a boost::thread_interrupted exception. If I figure out a way, I'll gladly use it.
Since gcc4.3 (?) it's possible to do this:
#include<cxxabi.h>
try { ... ::pthread_mutex_lock(&mutex); ::pthread_cond_wait (&condition,&mutex); } catch ( abi::__forced_unwind& ) { std::cout<< "thread cancelled"<< std::endl; throw boost::thread_interrupted; }
isn't this what you are looking for ?
On my linux system that aborts the program with "FATAL: exception not rethrown" Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976