summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/ManagedStatic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/ManagedStatic.cpp')
-rw-r--r--llvm/lib/Support/ManagedStatic.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
index 6a1c2a545a8..6f5cf6bcb1a 100644
--- a/llvm/lib/Support/ManagedStatic.cpp
+++ b/llvm/lib/Support/ManagedStatic.cpp
@@ -14,6 +14,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Atomic.h"
+#include "llvm/Support/MutexGuard.h"
#include <cassert>
using namespace llvm;
@@ -23,7 +24,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
void (*Deleter)(void*)) const {
assert(Creator);
if (llvm_is_multithreaded()) {
- llvm_acquire_global_lock();
+ llvm::MutexGuard Lock(llvm::llvm_get_global_lock());
if (!Ptr) {
void* tmp = Creator();
@@ -43,8 +44,6 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
Next = StaticList;
StaticList = this;
}
-
- llvm_release_global_lock();
} else {
assert(!Ptr && !DeleterFn && !Next &&
"Partially initialized ManagedStatic!?");
OpenPOWER on IntegriCloud