1 #include "thread_pool.h"
3 thread_pool::thread_pool(size_t sz) : th_(sz) {
5 t = thread(&thread_pool::do_worker, this);
8 // this function can be called only when no external thread will
9 // ever use this thread pool again or is currently blocking on it
10 thread_pool::~thread_pool() {
11 for (size_t i=0; i<th_.size(); i++)
18 bool thread_pool::addJob(const job_t & j) {
19 return jobq_.enq(j, false);
22 void thread_pool::do_worker() {
23 while (auto j = jobq_.deq())