fix: potential endless loop (#22)

* fix potential endless loop

* update code as well
This commit is contained in:
jkandpm
2018-04-18 13:02:50 +00:00
committed by Ou Changkun
parent eb249e8742
commit ec3e0e65ba
2 changed files with 2 additions and 0 deletions

View File

@@ -153,6 +153,7 @@ int main()
cond_var.notify_one(); cond_var.notify_one();
} }
done = true; done = true;
notified = true;
cond_var.notify_one(); cond_var.notify_one();
}); });

View File

@@ -39,6 +39,7 @@ int main()
cond_var.notify_one(); cond_var.notify_one();
} }
done = true; done = true;
notified = true;
cond_var.notify_one(); cond_var.notify_one();
}); });
// 消费者线程 // 消费者线程