This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: question about __cxa_guard_acquire and static variables in the scope of a function
On Mon, May 9, 2011 at 5:32 PM, Brendan Miller <catphive@catphive.net> wrote:
> On Mon, May 9, 2011 at 4:36 PM, Ian Lance Taylor <iant@google.com> wrote:
>> Brendan Miller <catphive@catphive.net> writes:
>>
>>> In G++ 4.1.2 one of my coworkers thinks he's seeing a case where the
>>> second time __cxa_guard_acquire is called, it does not block, but just
>>> throws an exception. Could someone please clarifies whether this is
>>> the expected behavior?
>>
>> No, but it's perhaps worth noting that this code has been rewritten
>> since 4.1.2. ?The 4.1.2 code was buggy when the initializer of a static
>> variable started a new thread which in turn tried to initialize the
>> static variable itself.
>>
>> Ian
>>
Having just replied, an important followup question has occurred to me.
Do you know if G++ 3.4 did thread-safe static local initialization in
this manner? This bug appeared after a migration from 3.4 to 4.1. I'm
wondering if statics in the scope of the function were previously
getting double-created and double destroyed, and we just didn't notice
somehow.
Thanks,
Brendan