diff options
-rw-r--r-- | llvm/include/llvm/Support/ManagedStatic.h | 6 | ||||
-rw-r--r-- | llvm/lib/Support/ManagedStatic.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/llvm/include/llvm/Support/ManagedStatic.h b/llvm/include/llvm/Support/ManagedStatic.h index 7eecce3241d..619cc205525 100644 --- a/llvm/include/llvm/Support/ManagedStatic.h +++ b/llvm/include/llvm/Support/ManagedStatic.h @@ -96,8 +96,10 @@ public: /// llvm_start_multithreaded - Allocate and initialize structures needed to -/// make LLVM safe for multithreading. -void llvm_start_multithreaded(); +/// make LLVM safe for multithreading. The return value indicates whether +/// multithreaded initialization succeeded. LLVM will still be operational +/// on "failed" return, but will not be safe to run multithreaded. +bool llvm_start_multithreaded(); /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. void llvm_shutdown(); diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp index 056b6c06c1e..a3b2bcc66a9 100644 --- a/llvm/lib/Support/ManagedStatic.cpp +++ b/llvm/lib/Support/ManagedStatic.cpp @@ -68,12 +68,13 @@ void ManagedStaticBase::destroy() const { DeleterFn = 0; } -void llvm::llvm_start_multithreaded() { +bool llvm::llvm_start_multithreaded() { #if LLVM_MULTITHREADED assert(ManagedStaticMutex == 0 && "Multithreaded LLVM already initialized!"); ManagedStaticMutex = new sys::Mutex(true); + return true; #else - assert(0 && "LLVM built without multithreading support!"); + return false; #endif } |