31 ThreadPool(absl::string_view prefix,
int num_threads);
35 void Schedule(std::function<
void()> closure);
40 const int num_workers_;
41 std::list<std::function<void()>> tasks_;
43 std::condition_variable condition_;
44 std::condition_variable capacity_condition_;
45 bool waiting_to_finish_ =
false;
46 bool waiting_for_capacity_ =
false;
47 bool started_ =
false;
48 int queue_capacity_ = 2e9;
49 std::vector<std::thread> all_workers_;