/* * The worker_thread blocks in this loop. * As a member function, it must be binded with this ptr. */ void worker_thread() { for (;;) { boost::mutex::scoped_lock lock(this->tp_mutex); cv.wait(lock); if (work_queue.empty()) continue; work_t w; if (work_queue.pop(w)) w->run(); else thread_run_error(); } }