[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / include / llvm / Support / thread.h
blob084ed16166feccae798036d9992d365ba6ea0984
1 //===-- llvm/Support/thread.h - Wrapper for <thread> ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This header is a wrapper for <thread> that works around problems with the
10 // MSVC headers when exceptions are disabled. It also provides llvm::thread,
11 // which is either a typedef of std::thread or a replacement that calls the
12 // function synchronously depending on the value of LLVM_ENABLE_THREADS.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_SUPPORT_THREAD_H
17 #define LLVM_SUPPORT_THREAD_H
19 #include "llvm/Config/llvm-config.h"
21 #if LLVM_ENABLE_THREADS
23 #include <thread>
25 namespace llvm {
26 typedef std::thread thread;
29 #else // !LLVM_ENABLE_THREADS
31 #include <utility>
33 namespace llvm {
35 struct thread {
36 thread() {}
37 thread(thread &&other) {}
38 template <class Function, class... Args>
39 explicit thread(Function &&f, Args &&... args) {
40 f(std::forward<Args>(args)...);
42 thread(const thread &) = delete;
44 void join() {}
45 static unsigned hardware_concurrency() { return 1; };
50 #endif // LLVM_ENABLE_THREADS
52 #endif