pthread_cleanup_push not working with uClibc

Alan Cooper alcooperx at gmail.com
Fri Mar 2 15:25:16 UTC 2012


I agree.
A quick fix for #1 would to change pthread.h so that
pthread_cleanup_push and pthread_cleanup_pop don't use a local class
but instead use the same method used by "C" modules. Do you think a
patch for this change would be accepted?
I also have the C++ unwind working for most cancellation points by
including the "-fexception" CFLAG for modules that are cancellation
points. I'd like to submit a patch for this separately.

Al

On Wed, Feb 29, 2012 at 12:29 PM, Rich Felker <dalias at aerifal.cx> wrote:
> On Wed, Feb 29, 2012 at 09:06:32AM -0500, Alan Cooper wrote:
>> I seems to me there are 2 different issues here.
>> 1. pthread_cleanup_push/pthread_cleanup_pop does not work for C++
>> programs. The cleanup routine passed to pthread_cleanup_push will not
>> be called when the thread is cancelled.
>> 2. Class destructors for locally scoped (stack based) classes are not
>> called when the thread is cancelled.
>>
>> Are you suggesting #1 is not a bug?
>
> I'm saying that #1 is definitely a bug no matter what, but #2 is only
> a bug in the sense that NPTL is trying to provide you an extra feature
> outside the scope of the standard (and failing to do so). Relying on
> #2 (and using cancellation in any situation where there are
> destructors that would need to be called) is NOT PORTABLE and means
> your program will only work on glibc (or, once it's fixed, uClibc)
> based systems.
>
> Rich
>
> P.S. Please use the mailing list (reply to list, not to me).


More information about the uClibc mailing list