LLVM API Documentation
00001 //===-- llvm/Support/Threading.h - Control multithreading mode --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares helper functions for running LLVM in a multi-threaded 00011 // environment. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_SUPPORT_THREADING_H 00016 #define LLVM_SUPPORT_THREADING_H 00017 00018 namespace llvm { 00019 /// Returns true if LLVM is compiled with support for multi-threading, and 00020 /// false otherwise. 00021 bool llvm_is_multithreaded(); 00022 00023 /// llvm_execute_on_thread - Execute the given \p UserFn on a separate 00024 /// thread, passing it the provided \p UserData. 00025 /// 00026 /// This function does not guarantee that the code will actually be executed 00027 /// on a separate thread or honoring the requested stack size, but tries to do 00028 /// so where system support is available. 00029 /// 00030 /// \param UserFn - The callback to execute. 00031 /// \param UserData - An argument to pass to the callback function. 00032 /// \param RequestedStackSize - If non-zero, a requested size (in bytes) for 00033 /// the thread stack. 00034 void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData, 00035 unsigned RequestedStackSize = 0); 00036 } 00037 00038 #endif