https://bugs.llvm.org/show_bug.cgi?id=44152
Bug ID: 44152
Summary: Change std::call_once to use per-flag lock rather than
global lock
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: deh...@motorola.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
In libc++, std::call_once uses a global lock. This seems like a poor design
choice.
Code here:
https://github.com/llvm/llvm-project/blob/master/libcxx/src/mutex.cpp#L226
Previously MSVC also used global lock but it was changed in 2015:
https://devblogs.microsoft.com/cppblog/stl-fixes-in-vs-2015-part-2/
More story:
https://stackoverflow.com/questions/22692783/is-stdcall-once-reentrant-and-thread-safe
https://stackoverflow.com/questions/26477070/concurrent-stdcall-once-calls
For scalability, I believe there should be one mutex per std::once_flag.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs