diff options
Diffstat (limited to 'llvm/lib/Support/ManagedStatic.cpp')
-rw-r--r-- | llvm/lib/Support/ManagedStatic.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp index 6a1c2a545a8..74884d93304 100644 --- a/llvm/lib/Support/ManagedStatic.cpp +++ b/llvm/lib/Support/ManagedStatic.cpp @@ -15,6 +15,7 @@ #include "llvm/Config/config.h" #include "llvm/Support/Atomic.h" #include <cassert> +#include <mutex> using namespace llvm; static const ManagedStaticBase *StaticList = nullptr; @@ -23,7 +24,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), void (*Deleter)(void*)) const { assert(Creator); if (llvm_is_multithreaded()) { - llvm_acquire_global_lock(); + std::lock_guard<llvm::recursive_mutex> Lock(llvm_get_global_lock()); if (!Ptr) { void* tmp = Creator(); @@ -44,7 +45,6 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), StaticList = this; } - llvm_release_global_lock(); } else { assert(!Ptr && !DeleterFn && !Next && "Partially initialized ManagedStatic!?"); @@ -77,6 +77,4 @@ void ManagedStaticBase::destroy() const { void llvm::llvm_shutdown() { while (StaticList) StaticList->destroy(); - - if (llvm_is_multithreaded()) llvm_stop_multithreaded(); } |