LLVM  6.0.0svn
thread.h
Go to the documentation of this file.
1 //===-- llvm/Support/thread.h - Wrapper for <thread> ------------*- 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 // This header is a wrapper for <thread> that works around problems with the
11 // MSVC headers when exceptions are disabled. It also provides llvm::thread,
12 // which is either a typedef of std::thread or a replacement that calls the
13 // function synchronously depending on the value of LLVM_ENABLE_THREADS.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_SUPPORT_THREAD_H
18 #define LLVM_SUPPORT_THREAD_H
19 
20 #include "llvm/Config/llvm-config.h"
21 
22 #if LLVM_ENABLE_THREADS
23 
24 #include <thread>
25 
26 namespace llvm {
28 }
29 
30 #else // !LLVM_ENABLE_THREADS
31 
32 #include <utility>
33 
34 namespace llvm {
35 
36 struct thread {
37  thread() {}
38  thread(thread &&other) {}
39  template <class Function, class... Args>
40  explicit thread(Function &&f, Args &&... args) {
41  f(std::forward<Args>(args)...);
42  }
43  thread(const thread &) = delete;
44 
45  void join() {}
46  static unsigned hardware_concurrency() { return 1; };
47 };
48 
49 }
50 
51 #endif // LLVM_ENABLE_THREADS
52 
53 #endif
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
std::string join(IteratorT Begin, IteratorT End, StringRef Separator)
Joins the strings in the range [Begin, End), adding Separator between the elements.
Definition: StringExtras.h:349
unsigned hardware_concurrency()
Get the number of threads that the current program can execute concurrently.
Definition: Threading.cpp:76
std::thread thread
Definition: thread.h:27
constexpr char Args[]
Key for Kernel::Metadata::mArgs.