Hello, Am Dienstag, den 05.08.2014, 13:09 -0400 schrieb Rich Felker: > > Linux manpages are more explicit and state: > > > > Clean-up handlers are not called if the thread terminates by > > performing a return from the thread start function. > > > > This patch aligns musl to that behavior. > > Could you clarify why this patch is necessary? I think such a return > is explicitly UB. > > "The effect of the use of return, break, continue, and goto to > prematurely leave a code block described by a pair of > pthread_cleanup_push() and pthread_cleanup_pop() functions calls is > undefined." yes The linux man page (glibc I suppose) has no such mention, only disallows longjmp and the phrase I cited above. I think this establishes an extension for POSIX on Linux systems. But I have another reason for wanting that, future compatibility with C threads. Programs that are written for C threads will not be aware of such interdictions. Concretely in our case of my C thread v3 patch a user can longjmp from a once-init-handler (written by her or him) through pthread_once (in libc, for musl with pthread_cleanup_push) to the thread start function (again user code) and then return from there. (All of this seems to be allowed by POSIX) I consider to not execute the cleanup handlers a little bit more friendly than executing them. Another possibility would be to split the behavior - abort for pthreads (this is nicer than executing the handlers or than silently ignore them) - ignore for C threads Jens -- :: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS ::: :: ::::::::::::::: office Strasbourg : +33 368854536 :: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::