[Lldb-commits] [PATCH] Use std::call_once for initialization
Zachary Turner
zturner at google.com
Wed Apr 1 10:04:00 PDT 2015
REPOSITORY
rL LLVM
================
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;
std::call_once(*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.
http://reviews.llvm.org/D8760
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the lldb-commits
mailing list