Tobias Wood | 94f5786 | 2023-05-05 16:23:34 +0000 | [diff] [blame] | 1 | // This file is part of Eigen, a lightweight C++ template library |
| 2 | // for linear algebra. |
| 3 | // |
| 4 | // Copyright (C) 2016 Benoit Steiner <benoit.steiner.goog@gmail.com> |
| 5 | // |
| 6 | // This Source Code Form is subject to the terms of the Mozilla |
| 7 | // Public License v. 2.0. If a copy of the MPL was not distributed |
| 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 9 | |
| 10 | #ifndef EIGEN_THREADPOOL_MODULE_H |
| 11 | #define EIGEN_THREADPOOL_MODULE_H |
| 12 | |
| 13 | #include "Core" |
| 14 | |
| 15 | #include "src/Core/util/DisableStupidWarnings.h" |
| 16 | |
| 17 | /** \defgroup ThreadPool_Module ThreadPool Module |
Tobias Wood | f38e16c | 2023-11-29 11:12:48 +0000 | [diff] [blame] | 18 | * |
| 19 | * This module provides 2 threadpool implementations |
| 20 | * - a simple reference implementation |
| 21 | * - a faster non blocking implementation |
| 22 | * |
| 23 | * \code |
| 24 | * #include <Eigen/ThreadPool> |
| 25 | * \endcode |
| 26 | */ |
Tobias Wood | 94f5786 | 2023-05-05 16:23:34 +0000 | [diff] [blame] | 27 | |
| 28 | #include <cstddef> |
| 29 | #include <cstring> |
| 30 | #include <time.h> |
| 31 | |
| 32 | #include <vector> |
| 33 | #include <atomic> |
| 34 | #include <condition_variable> |
| 35 | #include <deque> |
| 36 | #include <mutex> |
| 37 | #include <thread> |
| 38 | #include <functional> |
| 39 | #include <memory> |
| 40 | #include <utility> |
| 41 | |
| 42 | // There are non-parenthesized calls to "max" in the <unordered_map> header, |
| 43 | // which trigger a check in test/main.h causing compilation to fail. |
| 44 | // We work around the check here by removing the check for max in |
| 45 | // the case where we have to emulate thread_local. |
| 46 | #ifdef max |
| 47 | #undef max |
| 48 | #endif |
| 49 | #include <unordered_map> |
| 50 | |
| 51 | #include "src/Core/util/Meta.h" |
| 52 | #include "src/Core/util/MaxSizeVector.h" |
| 53 | |
Rasmus Munk Larsen | 96c4277 | 2023-05-09 19:36:17 +0000 | [diff] [blame] | 54 | #ifndef EIGEN_MUTEX |
| 55 | #define EIGEN_MUTEX std::mutex |
| 56 | #endif |
| 57 | #ifndef EIGEN_MUTEX_LOCK |
| 58 | #define EIGEN_MUTEX_LOCK std::unique_lock<std::mutex> |
| 59 | #endif |
| 60 | #ifndef EIGEN_CONDVAR |
| 61 | #define EIGEN_CONDVAR std::condition_variable |
| 62 | #endif |
| 63 | |
Tobias Wood | 94f5786 | 2023-05-05 16:23:34 +0000 | [diff] [blame] | 64 | // IWYU pragma: begin_exports |
| 65 | #include "src/ThreadPool/ThreadLocal.h" |
| 66 | #include "src/ThreadPool/ThreadYield.h" |
| 67 | #include "src/ThreadPool/ThreadCancel.h" |
| 68 | #include "src/ThreadPool/EventCount.h" |
| 69 | #include "src/ThreadPool/RunQueue.h" |
| 70 | #include "src/ThreadPool/ThreadPoolInterface.h" |
| 71 | #include "src/ThreadPool/ThreadEnvironment.h" |
| 72 | #include "src/ThreadPool/Barrier.h" |
| 73 | #include "src/ThreadPool/NonBlockingThreadPool.h" |
Charles Schlosser | 99adca8 | 2024-05-20 23:42:51 +0000 | [diff] [blame] | 74 | #include "src/ThreadPool/CoreThreadPoolDevice.h" |
Tobias Wood | 94f5786 | 2023-05-05 16:23:34 +0000 | [diff] [blame] | 75 | // IWYU pragma: end_exports |
| 76 | |
| 77 | #include "src/Core/util/ReenableStupidWarnings.h" |
| 78 | |
Tobias Wood | f38e16c | 2023-11-29 11:12:48 +0000 | [diff] [blame] | 79 | #endif // EIGEN_CXX11_THREADPOOL_MODULE_H |