Skip to content

Commit a24ae6c

Browse files
authored
fix: loss notify when HThreadPool::stop()
1 parent 88880c2 commit a24ae6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cpputil/hthreadpool.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ class HThreadPool {
8080

8181
int stop() {
8282
if (status == STOP) return -1;
83-
status = STOP;
83+
{
84+
std::unique_lock<std::mutex> locker(task_mutex);
85+
status = STOP;
86+
}
8487
task_cond.notify_all();
8588
for (auto& i : threads) {
8689
if (i.thread->joinable()) {

0 commit comments

Comments
 (0)