Avoid Watchdog thread clobbering m_isExpired flag after callback (#1527)

This commit is contained in:
Tyler Veness
2019-01-08 21:37:59 -06:00
committed by Peter Johnson
parent bc2c932f92
commit f121ccff0d
2 changed files with 12 additions and 2 deletions

View File

@@ -58,10 +58,15 @@ void Watchdog::Thread::Main() {
<< "s\n";
}
}
// Set expiration flag before calling the callback so any manipulation
// of the flag in the callback (e.g., calling Disable()) isn't
// clobbered.
watchdog->m_isExpired = true;
lock.unlock();
watchdog->m_callback();
lock.lock();
watchdog->m_isExpired = true;
}
// Otherwise, a Watchdog removed itself from the queue (it notifies the
// scheduler of this) or a spurious wakeup occurred, so just rewait with