addThread 工作线程函数97行99行
ZhuZouRong opened this issue · comments
unique_lock<mutex> lock{ _lock };
96 _task_cv.wait(lock, [this]{
97 return !_run || !_tasks.empty();
98 }); // wait 直到有 task
99 if (!_run && _tasks.empty())
100 return;
_tasks.empty() 为什么要判断两次呢
97 行是队列不为空就继续等待
99 行不也是队列不为空就往下