ThreadPool icon indicating copy to clipboard operation
ThreadPool copied to clipboard

a

Open fanhoumin opened this issue 1 year ago • 1 comments

When I use your thread library, I encountered an interesting issue. Is the following conditional redundant? Because theoretically, if our thread is not in a stopped state but the task queue is empty, it shouldn't leave the waiting state.std::unique_lock<std::mutex> lock(this->queue_mutex); this->condition.wait(lock, [this]{ return this->stop || !this->tasks.empty(); }); if(this->stop && this->tasks.empty()) return;

fanhoumin avatar Apr 27 '24 05:04 fanhoumin

if stop == true and tasks is empty, it will leave the waiting . This mean we were finished our tasks, then return.

Smalldy avatar Oct 18 '24 17:10 Smalldy