LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Threading.h
Go to the documentation of this file.
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 //
10 // TThis file defines llvm_start_multithreaded() and friends.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_SUPPORT_THREADING_H
15 #define LLVM_SUPPORT_THREADING_H
16 
17 namespace llvm {
18  /// llvm_start_multithreaded - Allocate and initialize structures needed to
19  /// make LLVM safe for multithreading. The return value indicates whether
20  /// multithreaded initialization succeeded. LLVM will still be operational
21  /// on "failed" return, and will still be safe for hosting threading
22  /// applications in the JIT, but will not be safe for concurrent calls to the
23  /// LLVM APIs.
24  /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.
26 
27  /// llvm_stop_multithreaded - Deallocate structures necessary to make LLVM
28  /// safe for multithreading.
29  /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.
31 
32  /// llvm_is_multithreaded - Check whether LLVM is executing in thread-safe
33  /// mode or not.
34  bool llvm_is_multithreaded();
35 
36  /// acquire_global_lock - Acquire the global lock. This is a no-op if called
37  /// before llvm_start_multithreaded().
39 
40  /// release_global_lock - Release the global lock. This is a no-op if called
41  /// before llvm_start_multithreaded().
43 
44  /// llvm_execute_on_thread - Execute the given \p UserFn on a separate
45  /// thread, passing it the provided \p UserData.
46  ///
47  /// This function does not guarantee that the code will actually be executed
48  /// on a separate thread or honoring the requested stack size, but tries to do
49  /// so where system support is available.
50  ///
51  /// \param UserFn - The callback to execute.
52  /// \param UserData - An argument to pass to the callback function.
53  /// \param RequestedStackSize - If non-zero, a requested size (in bytes) for
54  /// the thread stack.
55  void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData,
56  unsigned RequestedStackSize = 0);
57 }
58 
59 #endif
void llvm_acquire_global_lock()
Definition: Threading.cpp:58
void llvm_release_global_lock()
Definition: Threading.cpp:62
bool llvm_start_multithreaded()
Definition: Threading.cpp:26
bool llvm_is_multithreaded()
Definition: Threading.cpp:54
void llvm_execute_on_thread(void(*UserFn)(void *), void *UserData, unsigned RequestedStackSize=0)
Definition: Threading.cpp:79
void llvm_stop_multithreaded()
Definition: Threading.cpp:41