线程池ThreadPool

来源:互联网 发布:淘宝店名片设计 编辑:程序博客网 时间:2024/04/30 02:44

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);};
}}


原创粉丝点击