15 #ifndef LLVM_SUPPORT_THREADING_H
16 #define LLVM_SUPPORT_THREADING_H
19 #include "llvm/Config/llvm-config.h"
27 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
28 #elif defined(LLVM_ON_UNIX) && \
29 (defined(_LIBCPP_VERSION) || \
30 !(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__ppc__)))
34 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
36 #define LLVM_THREADING_USE_STD_CALL_ONCE 0
39 #if LLVM_THREADING_USE_STD_CALL_ONCE
65 unsigned RequestedStackSize = 0);
67 #if LLVM_THREADING_USE_STD_CALL_ONCE
73 enum InitStatus { Uninitialized = 0,
Wait = 1, Done = 2 };
100 #if LLVM_THREADING_USE_STD_CALL_ONCE
102 std::forward<Args>(ArgList)...);
107 if (old_val == Uninitialized) {
108 std::forward<Function>(
F)(std::forward<Args>(ArgList)...);
118 while (tmp != Done) {
void set_thread_name(const Twine &Name)
Set the name of the current thread.
unsigned heavyweight_hardware_concurrency()
Get the amount of currency to use for tasks requiring significant memory or other resources...
uint32_t get_max_thread_name_length()
Get the maximum length of a thread name on this platform.
void get_thread_name(SmallVectorImpl< char > &Name)
Get the name of the current thread.
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)
std::error_code status(const Twine &path, file_status &result, bool follow=true)
Get file status as if by POSIX stat().
#define TsanHappensAfter(cv)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
#define TsanHappensBefore(cv)
uint64_t get_threadid()
Return the current thread id, as used in various OS system calls.
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.