[PATCH] thread cancellation via C++ exception

Boris Kolpackov boris at kolpackov.net
Tue May 11 20:17:04 UTC 2004


Good day,

Just in case somebody would be interested:

This patch alters nptl to use C++ exception for thread cancellation.

When HAVE_FORCED_UNWIND is defined nptl uses forced unwinding of exception
handling mechanism (should we call it ABI exception handling?) to unwind
the stack and call cleanup handlers. This allows catching cancellation
exception with C++ catch(...) handler.

This patch makes nptl throw a C++ exception (std::thread_canceled, defined
in pthread.h) during thread cancellation. As a result you can use typed
handler to identify this situation:

  try
  {
 
    // ...  
 
  }
  catch (std::thread_caceled const&)
  {
    // ...
    throw;
  }

The patch is against cvs-2004-05-07 and is available from

ftp://kolpackov.net/pub/projects/glibc/ 

comments are welcome,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/phil-list/attachments/20040511/bb911e46/attachment.sig>


More information about the Phil-list mailing list