On Fri, Feb 24, 2012 at 12:26:13PM -0500, Alan Cooper wrote: > I'm having a problem with a C++ program where the the > pthread_cleanup_push cleanup routine is not being called when the > thread is cancelled. This is happening because class destructors are > not being called by the exception unwind routine. I found the problem > to be caused by the fact that some of the system calls that are > cancellation points, in this case sleep(), don't have the .eh_frame > info needed to unwind the stack frames and break the unwind chain. I > see that the CFLAGS for some modules have -fexceptions set, which will > cause the .eh_frame to be generated, but this flag is not set for all > the standard Linux defined cancellation points. Am I missing something > here or has this always been broken?
This probably isn't the answer you want to hear, but mixing pthread_cleanup_push/pop (or really, any use of pthread_cancel) with C++, exceptions, and/or objects with non-trivial destructors is completely non-portable and undefined behavior. I doubt any implementations but glibc/NPTL support it. Since uClibc is basically trying to follow glibc here, it might eventually work the way you want it in uClibc, but I would seriously rethink whether there's a more portable way you could achieve what you want to accomplish... Rich _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc