Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -56,16 +56,14 @@ void ProcessFreeBSD::Initialize() { - static bool g_initialized = false; + static std::once_flag g_once_flag; - if (!g_initialized) - { + std::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); ProcessPOSIXLog::Initialize(GetPluginNameStatic()); - g_initialized = true; - } + }); } lldb_private::ConstString Index: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp @@ -53,16 +53,14 @@ void ProcessLinux::Initialize() { - static bool g_initialized = false; + static std::once_flag g_once_flag; - if (!g_initialized) - { - g_initialized = true; + std::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); ProcessPOSIXLog::Initialize(GetPluginNameStatic()); - } + }); } //------------------------------------------------------------------------------ Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -835,24 +835,23 @@ void ProcessKDP::Initialize() { - static bool g_initialized = false; - - if (g_initialized == false) + static std::once_flag g_once_flag; + + std::call_once(g_once_flag, []() { - g_initialized = true; PluginManager::RegisterPlugin (GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, - DebuggerInitialize); - + DebuggerInitialize);a + Log::Callbacks log_callbacks = { ProcessKDPLog::DisableLog, ProcessKDPLog::EnableLog, ProcessKDPLog::ListLogCategories }; - + Log::RegisterLogChannel (ProcessKDP::GetPluginNameStatic(), log_callbacks); - } + }); } void Index: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp +++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp @@ -87,11 +87,10 @@ void ProcessWindows::Initialize() { - static bool g_initialized = false; + static std::once_flag g_once_flag; - if (!g_initialized) + std::call_once(g_once_flag, []() { - g_initialized = true; PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); Index: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -374,13 +374,13 @@ void ProcessElfCore::Initialize() { - static bool g_initialized = false; + static std::once_flag g_once_flag; - if (g_initialized == false) + std::call_once(g_once_flag, []() { - g_initialized = true; - PluginManager::RegisterPlugin (GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); - } + PluginManager::RegisterPlugin (GetPluginNameStatic(), + GetPluginDescriptionStatic(), CreateInstance); + }); } lldb::addr_t Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2958,16 +2958,15 @@ void ProcessGDBRemote::Initialize() { - static bool g_initialized = false; + static std::once_flag g_once_flag; - if (g_initialized == false) + std::call_once(g_once_flag, []() { - g_initialized = true; PluginManager::RegisterPlugin (GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, DebuggerInitialize); - } + }); } void Index: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -483,15 +483,13 @@ void ProcessMachCore::Initialize() { - static bool g_initialized = false; - - if (g_initialized == false) - { - g_initialized = true; + static std::once_flag g_once_flag; + + std::call_once(g_once_flag, []() { PluginManager::RegisterPlugin (GetPluginNameStatic(), GetPluginDescriptionStatic(), - CreateInstance); - } + CreateInstance); + }); } addr_t