summaryrefslogtreecommitdiff
path: root/lib/Support/Timer.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-06-16 22:39:38 +0000
committerZachary Turner <zturner@google.com>2014-06-16 22:39:38 +0000
commit9be5c8ca6bb5c91cbc23e24d8703a8e140d68397 (patch)
treef8a2ebc22725a545a708fee4e1d9c9991a1234aa /lib/Support/Timer.cpp
parent8b3a8d6343ae078a881abac4b5be067e74e5739a (diff)
downloadllvm-9be5c8ca6bb5c91cbc23e24d8703a8e140d68397.tar.gz
llvm-9be5c8ca6bb5c91cbc23e24d8703a8e140d68397.tar.bz2
llvm-9be5c8ca6bb5c91cbc23e24d8703a8e140d68397.tar.xz
Users of the llvm global mutex must now acquire it manually.
This allows the mutex to be acquired in a guarded, RAII fashion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Timer.cpp')
-rw-r--r--lib/Support/Timer.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index 61465ae5e8..417ac8d6bb 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -18,7 +18,7 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/Mutex.h"
+#include "llvm/support/MutexGuard.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -84,14 +84,13 @@ static TimerGroup *getDefaultTimerGroup() {
sys::MemoryFence();
if (tmp) return tmp;
- llvm_acquire_global_lock();
+ llvm::MutexGuard Lock(llvm::llvm_get_global_lock());
tmp = DefaultTimerGroup;
if (!tmp) {
tmp = new TimerGroup("Miscellaneous Ungrouped Timers");
sys::MemoryFence();
DefaultTimerGroup = tmp;
}
- llvm_release_global_lock();
return tmp;
}