[wpilib] Fix Watchdog to always ack notifier (#8472)

This commit is contained in:
Peter Johnson
2025-12-12 21:19:54 -07:00
committed by GitHub
parent 0049c6f23f
commit 2a41b80e00
2 changed files with 12 additions and 12 deletions

View File

@@ -120,7 +120,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
m_watchdogs.remove(this);
m_expirationTime = m_startTime + m_timeout;
m_watchdogs.add(this);
updateAlarm(false);
updateAlarm();
} finally {
m_queueMutex.unlock();
}
@@ -194,7 +194,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
m_watchdogs.remove(this);
m_expirationTime = m_startTime + m_timeout;
m_watchdogs.add(this);
updateAlarm(false);
updateAlarm();
} finally {
m_queueMutex.unlock();
}
@@ -205,7 +205,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
m_queueMutex.lock();
try {
m_watchdogs.remove(this);
updateAlarm(false);
updateAlarm();
} finally {
m_queueMutex.unlock();
}
@@ -223,12 +223,12 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
}
@SuppressWarnings("resource")
private static void updateAlarm(boolean acknowledge) {
private static void updateAlarm() {
if (m_watchdogs.isEmpty()) {
NotifierJNI.cancelNotifierAlarm(m_notifier, acknowledge);
NotifierJNI.cancelNotifierAlarm(m_notifier, true);
} else {
NotifierJNI.setNotifierAlarm(
m_notifier, (long) (m_watchdogs.peek().m_expirationTime * 1e6), 0, true, acknowledge);
m_notifier, (long) (m_watchdogs.peek().m_expirationTime * 1e6), 0, true, true);
}
}
@@ -277,7 +277,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
watchdog.m_callback.run();
m_queueMutex.lock();
updateAlarm(true);
updateAlarm();
} finally {
m_queueMutex.unlock();
}