mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Avoid Watchdog thread clobbering m_isExpired flag after callback (#1527)
This commit is contained in:
committed by
Peter Johnson
parent
bc2c932f92
commit
f121ccff0d
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user