diff options
| author | Owen Anderson <resistor@mac.com> | 2009-05-20 21:03:06 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-05-20 21:03:06 +0000 |
| commit | c7ccf81f8718f7d520c9d170929d851ce3f9ed2f (patch) | |
| tree | b7b8d9723b2b6dec81f4a27d4ee7a128b92c2019 | |
| parent | ed8a9c9a1249e7d95d59c579822ed92398cf508c (diff) | |
| download | external_llvm-c7ccf81f8718f7d520c9d170929d851ce3f9ed2f.zip external_llvm-c7ccf81f8718f7d520c9d170929d851ce3f9ed2f.tar.gz external_llvm-c7ccf81f8718f7d520c9d170929d851ce3f9ed2f.tar.bz2 | |
Have llvm_start_multithreaded return a bool indicating whether multithreaded
initialization succeeded or not, rather than just asserting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72182 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | include/llvm/Support/ManagedStatic.h | 6 | ||||
| -rw-r--r-- | lib/Support/ManagedStatic.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/include/llvm/Support/ManagedStatic.h b/include/llvm/Support/ManagedStatic.h index 7eecce3..619cc20 100644 --- a/include/llvm/Support/ManagedStatic.h +++ b/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/lib/Support/ManagedStatic.cpp b/lib/Support/ManagedStatic.cpp index 056b6c0..a3b2bcc 100644 --- a/lib/Support/ManagedStatic.cpp +++ b/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 } |
