Notifier: Fix condition variable race.

This commit is contained in:
Peter Johnson
2015-08-13 21:34:03 -07:00
parent 8d7cdeabbf
commit a395e3577f

View File

@@ -36,8 +36,10 @@ void Notifier::Stop() {
void Notifier::ThreadMain() {
std::unique_lock<std::mutex> lock(m_mutex);
while (m_active) {
m_cond.wait(lock);
if (!m_active) continue;
while (m_entry_notifications.empty() && m_conn_notifications.empty()) {
m_cond.wait(lock);
if (!m_active) return;
}
// Entry notifications
while (!m_entry_notifications.empty()) {