15 #include "llvm/Config/config.h"
27 #if LLVM_ENABLE_THREADS != 0
42 #if LLVM_ENABLE_THREADS != 0
66 #if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H)
70 void (*UserFn)(
void *);
80 unsigned RequestedStackSize) {
86 if (::pthread_attr_init(&Attr) != 0)
90 if (RequestedStackSize != 0) {
91 if (::pthread_attr_setstacksize(&Attr, RequestedStackSize) != 0)
100 ::pthread_join(Thread, 0);
103 ::pthread_attr_destroy(&Attr);
105 #elif LLVM_ENABLE_THREADS!=0 && defined(LLVM_ON_WIN32)
114 static unsigned __stdcall ThreadCallback(
void *param) {
116 info->func(info->param);
122 unsigned RequestedStackSize) {
125 HANDLE hThread = (HANDLE)::_beginthreadex(NULL,
126 RequestedStackSize, ThreadCallback,
135 (void)::WaitForSingleObject(hThread, INFINITE);
136 ::CloseHandle(hThread);
142 unsigned RequestedStackSize) {
143 (void) RequestedStackSize;
void llvm_acquire_global_lock()
static bool multithreaded_mode
void llvm_release_global_lock()
static void * ExecuteOnThread_Dispatch(void *Arg)
bool llvm_start_multithreaded()
SmartMutex< false > Mutex
Mutex - A standard, always enforced mutex.
static sys::Mutex * global_lock
bool llvm_is_multithreaded()
void llvm_execute_on_thread(void(*UserFn)(void *), void *UserData, unsigned RequestedStackSize=0)
void llvm_stop_multithreaded()