Async cacellation and pthread_cleanup_push

Andreas Schwab schwab@linux-m68k.org
Wed Aug 4 16:24:12 GMT 2021


On Aug 04 2021, Florian Weimer wrote:

> * Andreas Schwab:
>
>> On Aug 04 2021, Florian Weimer wrote:
>>
>>> * Andreas Schwab:
>>>
>>>> Is pthread_cleanup_push supposed to work together with async
>>>> cancellation?
>>>
>>> In our implementation?  I think so.
>>
>> I don't see how that can work with -fexceptions or in C++, though.  Is
>> that supported?
>
> I think it is supposed to work, but it probably is unreliable.

Since the compiler puts the exception regions only over function calls
(and -fnon-call-exceptions only covers potentially trapping insns in
addition) the cleanup region will not be fully covered.

>>> POSIX doesn't require it, though.
>>
>> Chapter and verse?
>
> 2.9.5 Thread Cancellation, Thread Cancellation Cleanup Handlers and
> Async-Cancel Safety.  The first section calls pthread_cleanup_push a
> function, the second section does not list it.
>
>> Then the LTP test is INVALID.
>
> Which test?  It could be a test for Linux extension.

testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list