24 #include "glog/logging.h" 31 for (
int i = 0; i != num_threads; ++i) {
41 CHECK_EQ(work_queue_.size(), 0);
43 for (std::thread& thread : pool_) {
51 work_queue_.push_back(work_item);
59 CHECK_NE(nice(10), -1);
62 std::function<void()> work_item;
66 return !work_queue_.empty() || !running_;
68 if (!work_queue_.empty()) {
69 work_item = work_queue_.front();
70 work_queue_.pop_front();
71 }
else if (!running_) {
void Schedule(std::function< void()> work_item)
Mutex::Locker MutexLocker
ThreadPool(int num_threads)