Async cacellation and pthread_cleanup_push

Florian Weimer fweimer@redhat.com
Mon Aug 23 09:43:26 GMT 2021


* Andreas Schwab:

> 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.

I can see how this can happen in theory …

>>>> 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

… but I don't see how this applies to this particular test.

Thanks,
Florian



More information about the Libc-alpha mailing list