[Lldb-commits] [PATCH] Use std::call_once for initialization
zturner at google.com
Wed Apr 1 10:04:00 PDT 2015
Comment at: source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:59
@@ -58,3 +58,3 @@
- static bool g_initialized = false;
+ static std::once_flag g_once_flag;
Can you change all these to:
static llvm::ManagedStatic<std::once_flag> g_once_flag;
The reason for this is that Windows and MSVC don't yet have thread-safe initialization of function local statics that have a constructor. On most platforms, members of once_flag are linker initialized, but on Windows they have an actual constructor.
You can add a TODO line that indicates that once we require MSVC 2015 as the minimum version, we can remove these and use regular std::once_flags. Same comment applies to all the rest of the occurrences in the file as well.
More information about the lldb-commits