Boost logo

Boost :

Subject: Re: [boost] [1.44] Beta progress?
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2010-08-06 09:55:40


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 ?

Regards
Gaetano Mendola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk