summaryrefslogtreecommitdiff
path: root/lib/Support/Threading.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-06-16 22:40:17 +0000
committerZachary Turner <zturner@google.com>2014-06-16 22:40:17 +0000
commitaedb5523d288ccc22c2119dc13ed61593bd25ee5 (patch)
tree2a70e22c08873a5022359c6a8517e57756226acb /lib/Support/Threading.cpp
parent9be5c8ca6bb5c91cbc23e24d8703a8e140d68397 (diff)
downloadllvm-aedb5523d288ccc22c2119dc13ed61593bd25ee5.tar.gz
llvm-aedb5523d288ccc22c2119dc13ed61593bd25ee5.tar.bz2
llvm-aedb5523d288ccc22c2119dc13ed61593bd25ee5.tar.xz
Remove some more code out into a separate CL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Threading.cpp')
-rw-r--r--lib/Support/Threading.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/lib/Support/Threading.cpp b/lib/Support/Threading.cpp
index 33943efcd6..ff591aaa1d 100644
--- a/lib/Support/Threading.cpp
+++ b/lib/Support/Threading.cpp
@@ -7,7 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements llvm_start_multithreaded() and friends.
+// This file implements helper functions for running LLVM in a multi-threaded
+// environment.
//
//===----------------------------------------------------------------------===//
@@ -19,43 +20,19 @@
using namespace llvm;
-static bool multithreaded_mode = false;
-
sys::Mutex& llvm::llvm_get_global_lock() {
static sys::Mutex global_lock;
return global_lock;
}
-bool llvm::llvm_start_multithreaded() {
+bool llvm::llvm_is_multithreaded() {
#if LLVM_ENABLE_THREADS != 0
- assert(!multithreaded_mode && "Already multithreaded!");
- multithreaded_mode = 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
}
-void llvm::llvm_stop_multithreaded() {
-#if LLVM_ENABLE_THREADS != 0
- assert(multithreaded_mode && "Not currently multithreaded!");
-
- // We fence here to insure that all threaded operations are complete BEFORE we
- // return from llvm_stop_multithreaded().
- sys::MemoryFence();
-
- multithreaded_mode = false;
-#endif
-}
-
-bool llvm::llvm_is_multithreaded() {
- return multithreaded_mode;
-}
-
#if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H)
#include <pthread.h>