Split the thread-related APIs out into their own file, and add a few more
[oota-llvm.git] / include / llvm / Support / Threading.h
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.
25   bool llvm_start_multithreaded();
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.
30   void llvm_stop_multithreaded();
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().
38   void llvm_acquire_global_lock();
39   
40   /// release_global_lock - Release the global lock.  This is a no-op if called
41   /// before llvm_start_multithreaded().
42   void llvm_release_global_lock();
43 }
44
45 #endif