pthread_cancel and EH: let's try this again

Alexander Terekhov terekhov at web.de
Sat Jul 16 13:48:36 UTC 2005


Dave Butenhof wrote:
[...]
> the cancel & exit EXCEPTIONS have names. They can be caught AND
> FINALIZED (legally not re-thrown) BY NAME

Yes.

>  (only). If caught anonymously, they must be re-thrown. 

This "compromise" makes no sense.

  void test_cancel() throw(thread_cancel_request) {
    pthread_testcancel();
  }

This

  try {
    testcancel(); // can throw only thread_cancel_request
  }
  catch(thread_cancel_request const &) { }

is oughta be the same as 

  try {
    testcancel(); // can throw only thread_cancel_request
  }
  catch(...) { }

Uhmm, unless you seriously want the above be written as

  try {
    testcancel(); // can throw only thread_cancel_request
  }
  catch(...) { 
    stop_stupid_abort();
  }

  void stop_stupid_abort() {
    try { throw; } catch(thread_cancel_request const &) { }
  }

regards,
alexander.




More information about the c++-pthreads mailing list