14 #ifndef OR_TOOLS_BASE_THREADPOOL_H_
15 #define OR_TOOLS_BASE_THREADPOOL_H_
17 #include <condition_variable>
28 ThreadPool(
const std::string& prefix,
int num_threads);
32 void Schedule(std::function<
void()> closure);
37 const int num_workers_;
38 std::list<std::function<void()>> tasks_;
40 std::condition_variable condition_;
41 std::condition_variable capacity_condition_;
42 bool waiting_to_finish_ =
false;
43 bool waiting_for_capacity_ =
false;
44 bool started_ =
false;
45 int queue_capacity_ = 2e9;
46 std::vector<std::thread> all_workers_;
49 #endif // OR_TOOLS_BASE_THREADPOOL_H_