This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1784. Concurrent execution during static local initialization

Section: 8.8  [stmt.dcl]     Status: C++17     Submitter: Jens Maurer     Date: 2013-09-27

[Adopted at the February/March, 2017 meeting as document P0250R3.]

Regarding initialization of a block-scope static variable, 8.8 [stmt.dcl] paragraph 4 says,

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

This specification does not use the terminology of 6.9.2 [intro.multithread], so the meaning of “wait” is not clear. For example, will a concurrent thread that “waited” see (in the sense of happens-before) the result of the initialization (including side effects caused during the initialization)?

Perhaps the “synchronizes-with” terminology could be used here.

Notes from the February, 2016 meeting:

SG1 concluded that wording similar to the following should be added:

For any action A such that the declaration is sequenced before A, initialization shall happen before A. The concurrent execution shall block for completion of the initialization.