summaryrefslogtreecommitdiff
path: root/include/llvm/Support/Threading.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
commit044eb2f6afba375a914ac9d8024f8f5142bb912e (patch)
tree1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /include/llvm/Support/Threading.h
parenteb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff)
Notes
Diffstat (limited to 'include/llvm/Support/Threading.h')
-rw-r--r--include/llvm/Support/Threading.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/Support/Threading.h b/include/llvm/Support/Threading.h
index 03963a24c107e..6d813bccb93fc 100644
--- a/include/llvm/Support/Threading.h
+++ b/include/llvm/Support/Threading.h
@@ -131,6 +131,14 @@ void llvm_execute_on_thread(void (*UserFn)(void *), void *UserData,
/// Returns 1 when LLVM is configured with LLVM_ENABLE_THREADS=OFF
unsigned heavyweight_hardware_concurrency();
+ /// Get the number of threads that the current program can execute
+ /// concurrently. On some systems std::thread::hardware_concurrency() returns
+ /// the total number of cores, without taking affinity into consideration.
+ /// Returns 1 when LLVM is configured with LLVM_ENABLE_THREADS=OFF.
+ /// Fallback to std::thread::hardware_concurrency() if sched_getaffinity is
+ /// not available.
+ unsigned hardware_concurrency();
+
/// \brief Return the current thread id, as used in various OS system calls.
/// Note that not all platforms guarantee that the value returned will be
/// unique across the entire system, so portable code should not assume