
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost- bounces@lists.boost.org] On Behalf Of Anthony Williams Sent: Friday, August 06, 2010 6:16 PM To: Gaetano Mendola Cc: boost@lists.boost.org Subject: Re: [boost] [1.44] Beta progress?
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"
That is exactly what is supposed to happen. NPTL uses abi::__forced_unwind for cancellation and it has to be rethrown. Regards, Dmitry