Re: [c++-pthreads] Re: [PATCH] thread cancellation via C++ exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] Re: [PATCH] thread cancellation via C++ exception



Dave Butenhof wrote:
[...]
> Yes, Alexander, there's no reason a cancel exception cannot be
> finalized, once it's been made an exception. In fact, once you've made
> it a standard system exception, you'll need to add special case code
> (probably in several places) to prevent it from being finalized using
> normal exception mechanisms like 'catch(...)'. 

catch(...) {
  try { 
    throw; 
  } 
  catch(std::thread_termination_request const &) { 
    throw; // std::thread_cancel_request or std::thread_exit_request
  }
  ...
}

>                                                On the other hand, it
> should be a fairly strong policy that only in rare cases SHOULD you
> finalize a cancel. You'd need to KNOW, absolutely, that this particular
> cancellation intended to cancel a "subsystem" rather than "the thread".

DS calls it a "job". ;-)

regards,
alexander.