[PATCH] Remove support for enabling / disabling multi-threading at runtime.

Reid Kleckner rnk at google.com
Mon Jun 9 16:07:23 PDT 2014


Nice!  I want to get a little more support for this direction before committing.  Let me try to rope in some appropriate people.  In the meantime, I had some comments.

================
Comment at: include/llvm-c/Core.h:2856
@@ -2855,3 @@
-    @see llvm::llvm_start_multithreaded */
-LLVMBool LLVMStartMultithreaded(void);
-
----------------
The C API is one of the few places where we have hard ABI stability guarantees.  These should become no-op stubs.

================
Comment at: include/llvm/Support/Threading.h:38
@@ +37,3 @@
+  /// llvm_get_global_lock() - returns the llvm global lock object.
+  llvm::recursive_mutex& llvm_get_global_lock();
+
----------------
nit: LLVM is in the 'star-on-the-right' camp.

================
Comment at: lib/Support/Threading.cpp:28-32
@@ -27,13 +27,7 @@
+bool llvm::llvm_is_multithreaded() {
 #if LLVM_ENABLE_THREADS != 0
-  assert(!multithreaded_mode && "Already multithreaded!");
-  multithreaded_mode = true;
-  global_lock = new sys::Mutex(true);
-
-  // We fence here to ensure that all initialization is complete BEFORE we
-  // return from llvm_start_multithreaded().
-  sys::MemoryFence();
   return true;
 #else
   return false;
 #endif
 }
----------------
return bool(LLVM_ENABLE_THREADS) ?

http://reviews.llvm.org/D4076






More information about the llvm-commits mailing list