[prev in list] [next in list] [prev in thread] [next in thread] 

List:       glibc-alpha
Subject:    [PING 3] Re: [PATCH] pthread_once hangs when init routine throws an exception [BZ #18435]
From:       Martin Sebor <msebor () redhat ! com>
Date:       2015-06-30 23:25:31
Message-ID: 5593256B.5060402 () redhat ! com
[Download RAW message or body]

Are there any unresolved concerns with or objections to this
patch?

   https://sourceware.org/ml/libc-alpha/2015-06/msg00348.html

On 06/22/2015 01:55 PM, Martin Sebor wrote:
> Are there any concerns with this patch?
>
>    https://sourceware.org/ml/libc-alpha/2015-06/msg00348.html
>
> Martin
>
> On 06/15/2015 01:23 PM, Martin Sebor wrote:
>> On 06/09/2015 01:43 PM, Martin Sebor wrote:
>>> Attached is an updated version of the patch that addresses
>>> the LDFLAGS -> LDLIBS comment. Retested on ppc64.
>>>
>>> Is it okay to commit?
>>
>> Are there any outstanding concerns with this version of
>> the patch or is it good to commit?
>>
>> Martin
>>
>>>
>>> Martin
>>>
>>> On 05/31/2015 03:37 PM, Martin Sebor wrote:
>>>> The C++ 2011 std::call_once function is specified to allow
>>>> the initialization routine to exit by throwing an exception.
>>>> Such an execution, termed exceptional, requires call_once to
>>>> propagate the exception to its caller. A program may contain
>>>> any number of exceptional executions but only one returning
>>>> execution (which, if it exists, must be the last execution
>>>> with the same once flag).
>>>>
>>>> On POSIX systems such as Linux std::call_once is implemented
>>>> in terms of pthread_once. However, as discussed in libstdc++
>>>> bug 66146 - "call_once not C++11-compliant on ppc64le," GLIBC's
>>>> pthread_once hangs when the initialization function exits by
>>>> throwing an exception on at least arm and ppc64 (though
>>>> apparently not on x86_64). This effectively prevents call_once
>>>> from conforming to the C++ requirements since there doesn't
>>>> appear to be a thread-safe way to work around this problem in
>>>> libstdc++.
>>>>
>>>> The attached patch changes pthread_once to handle gracefully
>>>> init functions that exit by throwing exceptions. It has been
>>>> tested on ppc64, ppc64le, and x86_64 with no regressions.
>>>>
>>>> During the discussion of the bug concerns were raised about
>>>> whether the use case of throwing exceptions from the
>>>> pthread_once init routine is intended to be supported either
>>>> by POSIX, or by GLIBC. After some research I believe that both
>>>> POSIX and GLIBC have, in fact, intended to support it, for at
>>>> least two reasons:
>>>>
>>>> First, the POSIX Rationale states in section Thread Cancellation
>>>> Overview, under Thread Cancellation Cleanup Handlers, that:
>>>>
>>>>    it is an explicit goal of POSIX.1-2008 to be compatible with
>>>>    existing exception facilities and languages having exceptions.
>>>>
>>>> Second, as is evident from the comment above the pthread_once
>>>> declaration in GLIBC (quoted below), GLIBC too has intended
>>>> to support this use case since 2004 when the comment was
>>>> added (and the __THROW specification removed from the API):
>>>>
>>>>     ...
>>>>     The initialization functions might throw exception which
>>>>     is why this function is not marked with __THROW.  */
>>>>
>>>> Martin
>>>
>>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic