tensorflow::tensorflow/core/lib/core/threadpool.h
namespace tensorflow { namespace thread {
class ThreadPool { public: ThreadPool(Env* env, const ThreadOptions& thread_options, const string& name, int num_threads, bool low_latency_hint); ThreadPool(Env* env, const string& name, int num_threads);
ThreadPool(Env* env, const ThreadOptions& thread_options, const string& name, int num_threads);
~ThreadPool();
void Schedule(std::function<void()> fn); void ParallelFor(int64 total, int64 cost_per_unit, std::function<void(int64, int64)> fn);
void ParallelForWithWorkerId( int64 total, int64 cost_per_unit, const std::function<void(int64, int64, int)>& fn);
int NumThreads() const;
int CurrentThreadId() const;
struct Impl;
private: std::unique_ptr<Impl> impl_; TF_DISALLOW_COPY_AND_ASSIGN(ThreadPool); };
} }