-
Notifications
You must be signed in to change notification settings - Fork 782
Description
The footnote about deadlocks for thread-safe statics is confusing. Here's the relevant text from the draft standard:
6.7 Declaration statement [stmt.dcl]
4 [...] If control enters the declaration concurrently while
the variable is being initialized, the concurrent execution
shall wait for completion of the initialization. (92) [...]
92) The implementation must not introduce any deadlock
around execution of the initializer
The footnote can be (mis) interpreted to mean that the synchronization objects guarding thread safe statics can not participate in a deadlock.
It is my understanding that this footnote was added to prohibit an implementation that uses a single global recursive mutex to guard all statics. Stated in a different way, the language has added some deadlocks, but the implementation is not permitted to add any deadlocks beyond those that the language has already added.
A few possible ways to fix this wording issue:
-
Clarify the footnote so that it doesn't suggest a total lack of deadlocks.
"The implementation must not introduce any deadlocks around execution of the initializer that are not implied by the program semantics"
-
Remove the footnote.
Discussion on the clang-dev mailing list on this issue can be found here.