15 #ifndef LLVM_SUPPORT_THREADING_H
16 #define LLVM_SUPPORT_THREADING_H
18 #include "llvm/Config/llvm-config.h"
26 #if defined(LLVM_ON_UNIX) && (defined(_LIBCPP_VERSION) || \
27 !(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__ppc__)))
28 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
30 #define LLVM_THREADING_USE_STD_CALL_ONCE 0
33 #if LLVM_THREADING_USE_STD_CALL_ONCE
57 unsigned RequestedStackSize = 0);
59 #if LLVM_THREADING_USE_STD_CALL_ONCE
65 #define LLVM_DEFINE_ONCE_FLAG(flag) static once_flag flag
69 enum InitStatus { Uninitialized = 0,
Wait = 1, Done = 2 };
74 #define LLVM_DEFINE_ONCE_FLAG(flag) static once_flag flag = Uninitialized
92 #if LLVM_THREADING_USE_STD_CALL_ONCE
94 std::forward<Args>(ArgList)...);
99 if (old_val == Uninitialized) {
100 std::forward<Function>(
F)(std::forward<Args>(ArgList)...);
110 while (tmp != Done) {
unsigned heavyweight_hardware_concurrency()
Get the amount of currency to use for tasks requiring significant memory or other resources...
void call_once(once_flag &flag, Function &&F, Args &&...ArgList)
Execute the function specified as a parameter once.
cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)
#define TsanHappensAfter(cv)
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
#define TsanHappensBefore(cv)
void llvm_execute_on_thread(void(*UserFn)(void *), void *UserData, unsigned RequestedStackSize=0)
llvm_execute_on_thread - Execute the given UserFn on a separate thread, passing it the provided UserD...
#define TsanIgnoreWritesBegin()
#define TsanIgnoreWritesEnd()
ProcessInfo Wait(const ProcessInfo &PI, unsigned SecondsToWait, bool WaitUntilTerminates, std::string *ErrMsg=nullptr)
This function waits for the process specified by PI to finish.