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
This commit is contained in:
Zachary Turner
2014-06-16 22:39:38 +00:00
parent 8b3a8d6343
commit 9be5c8ca6b
5 changed files with 16 additions and 26 deletions

View File

@ -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;
}