Subject: Re: [boost] [any] new version
From: Kim Barrett (kab.conundrums_at_[hidden])
Date: 2011-09-05 15:08:34


On Sep 5, 2011, at 2:17 PM, Dave Abrahams wrote:
> on Mon Sep 05 2011, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org> wrote:
>
>> The C++11 standard (the only one aware of multithreading) mandates
>> that initialization of static variables at function scope is
>> thread-safe.
>
> Really? I didn't pay attention to ever twist or turn of the process of
> standardizing multithreading, but it greatly surprises me to hear that,
> because it would impose an overhead on those function-static variables
> that don't need synchronization. Can you cite the paragraphs that give
> this guarantee?

SC-22-N-411, 6.7/4 "Declaration statement" says, while discussing initialization
of an object with static storage duration the first time control passes through its
declaration:

    If control enters the declaration concurrently while the object is being
    initialized, the concurrent execution shall wait for completion of the
    initialization.