10 #ifndef EIGEN_CXX11_THREADPOOL_SIMPLE_THREAD_POOL_H 11 #define EIGEN_CXX11_THREADPOOL_SIMPLE_THREAD_POOL_H 20 template <
typename Environment>
26 for (
int i = 0; i < num_threads; i++) {
36 std::unique_lock<std::mutex> l(
mu_);
58 void Schedule(std::function<
void()> fn) final {
59 Task t =
env_.CreateTask(std::move(fn));
60 std::unique_lock<std::mutex> l(
mu_);
67 w->
task = std::move(t);
78 if (pt->
pool ==
this) {
87 std::unique_lock<std::mutex> l(
mu_);
121 typedef typename Environment::Task
Task;
122 typedef typename Environment::EnvThread
Thread;
125 std::condition_variable
cv;
154 #endif // EIGEN_CXX11_THREADPOOL_SIMPLE_THREAD_POOL_H
std::condition_variable empty_
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void push_back(const T &t)
void WorkerLoop(int thread_id)
Environment::EnvThread Thread
void Schedule(std::function< void()> fn) final
std::condition_variable cv
SimpleThreadPoolTempl(int num_threads, Environment env=Environment())
SimpleThreadPoolTempl * pool
int NumThreads() const final
std::deque< Task > pending_
MaxSizeVector< Waiter * > waiters_
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t size() const
SimpleThreadPoolTempl< StlThreadEnvironment > SimpleThreadPool
TFSIMD_FORCE_INLINE const tfScalar & w() const
PerThread * GetPerThread() const
#define EIGEN_THREAD_LOCAL
int CurrentThreadId() const final
MaxSizeVector< Thread * > threads_