[PATCH] thread cancellation via C++ exception
Boris Kolpackov <[email protected]> Tue, 11 May 2004 15:17:04 -0500
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <[email protected]> |
--===============2083618676==
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature"; boundary="W/nzBZO5zC0uMSeA"
Content-Disposition: inline
--W/nzBZO5zC0uMSeA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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
{
=20
// ... =20
=20
}
catch (std::thread_caceled const&)
{
// ...
throw;
}
The patch is against cvs-2004-05-07 and is available from
ftp://kolpackov.net/pub/projects/glibc/=20
comments are welcome,
-boris
--W/nzBZO5zC0uMSeA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iQGVAwUBQKE0v8iAKQuuCE8dAQLhjgv/SIfODsS41U7w8fkHTQJnsWrPh81SSujh
cG1Zs/Jk/y/zUKRjk2EWfG9n+tE+ZMLVzm63To3i6WJy8SCrsiEY5vQ7pFJor6Vu
fRUIPI6BJGCl8gKWEqGBpUX0UrUeBHjBvvsWT5WEFmt06EofGDYwUcoLS2d5CQWT
CvmMnw6lV0Ng43zozwwf5AFWqO5/RbmT3xVvvy2PavMeqYnxnz/aDn+2HG4OWfy7
7BKJP9gZ9NJJ4iFtky3WqIHPtCLjRkuXcNQFBGJy6GdFpgWV7FCrICjhor+l6bz4
Yo/sIKKKt50052eW09ar74DodwhyMYpcDUBbkihE0zQ/moqd7WnOBcgaZbaupfND
jI20knbD+PyAw5rKmwFqKVICGF+HzXXlFCVng7/GwQV+Izz3vYXIpz4/WgphIuiL
3bkYh8a+PvuJREF9NcWhOKcGUw1qYu17RL1WilDi93stgEzY1GByxN3+qpCCQ1lH
I+Kw1+YIcHeKA4uo/0br3KMWAFUg+e7v
=4+L4
-----END PGP SIGNATURE-----
--W/nzBZO5zC0uMSeA--
--===============2083618676==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline