[llvm-commits] [llvm] r72182 - in /llvm/trunk: include/llvm/Support/ManagedStatic.h lib/Support/ManagedStatic.cpp
Owen Anderson
resistor at mac.com
Wed May 20 14:03:08 PDT 2009
Author: resistor
Date: Wed May 20 16:03:06 2009
New Revision: 72182
URL: http://llvm.org/viewvc/llvm-project?rev=72182&view=rev
Log:
Have llvm_start_multithreaded return a bool indicating whether multithreaded
initialization succeeded or not, rather than just asserting.
Modified:
llvm/trunk/include/llvm/Support/ManagedStatic.h
llvm/trunk/lib/Support/ManagedStatic.cpp
Modified: llvm/trunk/include/llvm/Support/ManagedStatic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ManagedStatic.h?rev=72182&r1=72181&r2=72182&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ManagedStatic.h (original)
+++ llvm/trunk/include/llvm/Support/ManagedStatic.h Wed May 20 16:03:06 2009
@@ -96,8 +96,10 @@
/// 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();
Modified: llvm/trunk/lib/Support/ManagedStatic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ManagedStatic.cpp?rev=72182&r1=72181&r2=72182&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ManagedStatic.cpp (original)
+++ llvm/trunk/lib/Support/ManagedStatic.cpp Wed May 20 16:03:06 2009
@@ -68,12 +68,13 @@
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
}
More information about the llvm-commits
mailing list