diff options
author | Jiangning Liu <jiangning.liu@arm.com> | 2014-11-05 04:44:31 +0000 |
---|---|---|
committer | Jiangning Liu <jiangning.liu@arm.com> | 2014-11-05 04:44:31 +0000 |
commit | 1fb71bc395ca270bbd4c652d892cda3d6446b5d3 (patch) | |
tree | edb4a56477152fe737955c8822bd769614b33953 /llvm/lib/Support/ManagedStatic.cpp | |
parent | 12b50a95c94765cb369f09eeabf7db5fef4442f2 (diff) | |
download | bcm5719-llvm-1fb71bc395ca270bbd4c652d892cda3d6446b5d3.tar.gz bcm5719-llvm-1fb71bc395ca270bbd4c652d892cda3d6446b5d3.zip |
Revert 220932.
Commit 220932 caused crash when building clang-tblgen on aarch64 debian target,
so it's blocking all daily tests.
The std::call_once implementation in pthread has bug for aarch64 debian.
llvm-svn: 221331
Diffstat (limited to 'llvm/lib/Support/ManagedStatic.cpp')
-rw-r--r-- | llvm/lib/Support/ManagedStatic.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp index b1feddc09ec..b8fb2841e52 100644 --- a/llvm/lib/Support/ManagedStatic.cpp +++ b/llvm/lib/Support/ManagedStatic.cpp @@ -16,23 +16,16 @@ #include "llvm/Support/Atomic.h" #include "llvm/Support/Mutex.h" #include "llvm/Support/MutexGuard.h" -#include "llvm/Support/Threading.h" #include <cassert> using namespace llvm; static const ManagedStaticBase *StaticList = nullptr; -static sys::Mutex *ManagedStaticMutex = nullptr; -LLVM_DEFINE_ONCE_FLAG(mutex_init_flag); -static void initializeMutex() { - ManagedStaticMutex = new sys::Mutex(); -} - -static sys::Mutex* getManagedStaticMutex() { +static sys::Mutex& getManagedStaticMutex() { // We need to use a function local static here, since this can get called // during a static constructor and we need to guarantee that it's initialized // correctly. - call_once(mutex_init_flag, initializeMutex); + static sys::Mutex ManagedStaticMutex; return ManagedStaticMutex; } @@ -40,7 +33,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), void (*Deleter)(void*)) const { assert(Creator); if (llvm_is_multithreaded()) { - MutexGuard Lock(*getManagedStaticMutex()); + MutexGuard Lock(getManagedStaticMutex()); if (!Ptr) { void* tmp = Creator(); @@ -90,7 +83,7 @@ void ManagedStaticBase::destroy() const { /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. void llvm::llvm_shutdown() { - MutexGuard Lock(*getManagedStaticMutex()); + MutexGuard Lock(getManagedStaticMutex()); while (StaticList) StaticList->destroy(); |