[Lldb-commits] [PATCH] D44060: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex
Phabricator via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 12 08:55:59 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346673: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex (authored by kuba.brecka, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D44060?vs=136886&id=173690#toc
Repository:
rL LLVM
https://reviews.llvm.org/D44060
Files:
lldb/trunk/source/Core/PluginManager.cpp
Index: lldb/trunk/source/Core/PluginManager.cpp
===================================================================
--- lldb/trunk/source/Core/PluginManager.cpp
+++ lldb/trunk/source/Core/PluginManager.cpp
@@ -286,7 +286,10 @@
typedef std::vector<ArchitectureInstance> ArchitectureInstances;
-static std::mutex g_architecture_mutex;
+static std::mutex &GetArchitectureMutex() {
+ static std::mutex g_architecture_mutex;
+ return g_architecture_mutex;
+}
static ArchitectureInstances &GetArchitectureInstances() {
static ArchitectureInstances g_instances;
@@ -296,13 +299,13 @@
void PluginManager::RegisterPlugin(const ConstString &name,
llvm::StringRef description,
ArchitectureCreateInstance create_callback) {
- std::lock_guard<std::mutex> guard(g_architecture_mutex);
+ std::lock_guard<std::mutex> guard(GetArchitectureMutex());
GetArchitectureInstances().push_back({name, description, create_callback});
}
void PluginManager::UnregisterPlugin(
ArchitectureCreateInstance create_callback) {
- std::lock_guard<std::mutex> guard(g_architecture_mutex);
+ std::lock_guard<std::mutex> guard(GetArchitectureMutex());
auto &instances = GetArchitectureInstances();
for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) {
@@ -316,7 +319,7 @@
std::unique_ptr<Architecture>
PluginManager::CreateArchitectureInstance(const ArchSpec &arch) {
- std::lock_guard<std::mutex> guard(g_architecture_mutex);
+ std::lock_guard<std::mutex> guard(GetArchitectureMutex());
for (const auto &instances : GetArchitectureInstances()) {
if (auto plugin_up = instances.create_callback(arch))
return plugin_up;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44060.173690.patch
Type: text/x-patch
Size: 1741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181112/2b12e676/attachment.bin>
More information about the lldb-commits
mailing list