ThreadPool 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #ifndef EIGEN_CXX11_THREADPOOL_MODULE
  10. #define EIGEN_CXX11_THREADPOOL_MODULE
  11. #include "../../../Eigen/Core"
  12. #include "../../../Eigen/src/Core/util/DisableStupidWarnings.h"
  13. /** \defgroup CXX11_ThreadPool_Module C++11 ThreadPool Module
  14. *
  15. * This module provides 2 threadpool implementations
  16. * - a simple reference implementation
  17. * - a faster non blocking implementation
  18. *
  19. * This module requires C++11.
  20. *
  21. * \code
  22. * #include <Eigen/CXX11/ThreadPool>
  23. * \endcode
  24. */
  25. // The code depends on CXX11, so only include the module if the
  26. // compiler supports it.
  27. #if (EIGEN_COMP_CXXVER >= 11)
  28. #include <cstddef>
  29. #include <cstring>
  30. #include <time.h>
  31. #include <vector>
  32. #include <atomic>
  33. #include <condition_variable>
  34. #include <deque>
  35. #include <mutex>
  36. #include <thread>
  37. #include <functional>
  38. #include <memory>
  39. #include <utility>
  40. // There are non-parenthesized calls to "max" in the <unordered_map> header,
  41. // which trigger a check in test/main.h causing compilation to fail.
  42. // We work around the check here by removing the check for max in
  43. // the case where we have to emulate thread_local.
  44. #ifdef max
  45. #undef max
  46. #endif
  47. #include <unordered_map>
  48. #include "src/util/CXX11Meta.h"
  49. #include "src/util/MaxSizeVector.h"
  50. #include "src/ThreadPool/ThreadLocal.h"
  51. #include "src/ThreadPool/ThreadYield.h"
  52. #include "src/ThreadPool/ThreadCancel.h"
  53. #include "src/ThreadPool/EventCount.h"
  54. #include "src/ThreadPool/RunQueue.h"
  55. #include "src/ThreadPool/ThreadPoolInterface.h"
  56. #include "src/ThreadPool/ThreadEnvironment.h"
  57. #include "src/ThreadPool/Barrier.h"
  58. #include "src/ThreadPool/NonBlockingThreadPool.h"
  59. #endif
  60. #include "../../../Eigen/src/Core/util/ReenableStupidWarnings.h"
  61. #endif // EIGEN_CXX11_THREADPOOL_MODULE