[592] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Re: pthread_cancel and cleanup handlers

daemon@ATHENA.MIT.EDU (Craig Taverner)
Wed Mar 12 07:52:25 1997

Date: Wed, 12 Mar 1997 14:35:45 +0200 (SAT)
From: Craig Taverner <craig@hobbes.gh.wits.ac.za>
To: pthreads@MIT.EDU
In-Reply-To: <332048F5.7C093EC7@healthcare.com>

-----BEGIN PGP SIGNED MESSAGE-----

Hi again,

I seem to have found a bug in the LinuxThreads package of Xavier Leroy.  I
did some pthread development under solaris 2.5 (using the solaris version
of pthreads) and found that the include file macros for
pthread_cleanup_push() and pthread_cleanup_pop() required that they both
by used in the same block of code (due to extra '{' and '}' braces in the
macros).  This is not critical, but it clearly in inconvenience.

When I ported my code to Linux using LinuxThreads, I found a substantially
more serious problem with the cleanup handlers, and that was that they
were only called by pthread_exit() (which the solaris ones do not do).
This meant that the cancelling a thread with pthread_cancel did not call
the cleanup handler under linux, but did under solaris, and pthread_exit()
did call the handler under linux but not under solaris.

What is the correct posix behavior here?  My solaris code had (presumably
incorrectly) the cleanup handler ending with pthread_exit() which caused
the clenaup handler to call itself recursively under linux.

Cheers, Craig

- ------
"One Page Principle:
        A specification that will not fit on one page of 8.5x11 inch
 paper cannot be understood."
                -- Mark Ardis

Craig Taverner
Structural Chemistry, University of the Witwatersrand, South Africa
tel:   +27-11-716-2290                fax: +27-11-716-3826
email: craig@hobbes.gh.wits.ac.za
www:   http://www.gh.wits.ac.za/craig

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBMyajJoGTdcQ2o38lAQHDcAP+IaU7qH5K7BvwHYnKQQFbR366yw2t4eMY
piQkvtpSxEGeFevEd6Nk0wciCo6uukLO7Ohe5KtGB0B0GF1ufTLdFl03XsFfMWYM
WWiwygPcpRYcBvm7zA/OZdmlVYh9zAf1nYoeceEYwRSb7GdNEt6Iwp58RcOYUN2o
6bao4QV4Z2s=
=dSla
-----END PGP SIGNATURE-----


home help back first fref pref prev next nref lref last post