]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
1 | //===-- llvm/Support/Threading.h - Control multithreading mode --*- C++ -*-===// |
2 | // | |
3 | // The LLVM Compiler Infrastructure | |
4 | // | |
5 | // This file is distributed under the University of Illinois Open Source | |
6 | // License. See LICENSE.TXT for details. | |
7 | // | |
8 | //===----------------------------------------------------------------------===// | |
9 | // | |
1a4d82fc JJ |
10 | // This file declares helper functions for running LLVM in a multi-threaded |
11 | // environment. | |
223e47cc LB |
12 | // |
13 | //===----------------------------------------------------------------------===// | |
14 | ||
970d7e83 LB |
15 | #ifndef LLVM_SUPPORT_THREADING_H |
16 | #define LLVM_SUPPORT_THREADING_H | |
223e47cc LB |
17 | |
18 | namespace llvm { | |
1a4d82fc JJ |
19 | /// Returns true if LLVM is compiled with support for multi-threading, and |
20 | /// false otherwise. | |
223e47cc LB |
21 | bool llvm_is_multithreaded(); |
22 | ||
223e47cc | 23 | /// llvm_execute_on_thread - Execute the given \p UserFn on a separate |
85aaf69f SL |
24 | /// thread, passing it the provided \p UserData and waits for thread |
25 | /// completion. | |
223e47cc LB |
26 | /// |
27 | /// This function does not guarantee that the code will actually be executed | |
28 | /// on a separate thread or honoring the requested stack size, but tries to do | |
29 | /// so where system support is available. | |
30 | /// | |
31 | /// \param UserFn - The callback to execute. | |
32 | /// \param UserData - An argument to pass to the callback function. | |
33 | /// \param RequestedStackSize - If non-zero, a requested size (in bytes) for | |
34 | /// the thread stack. | |
35 | void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData, | |
36 | unsigned RequestedStackSize = 0); | |
37 | } | |
38 | ||
39 | #endif |