From cbe447aad7d030b3ac6bbf351fa97f4bda32951a Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 11 Dec 2025 23:31:49 -0700 Subject: [PATCH] [hal] Notifier: Reset signal object on ack (#8466) This is needed to avoid spurious wakeups in WaitForObject due to a previous alarm having set the signal object. --- hal/src/main/native/sim/Notifier.cpp | 3 +++ hal/src/main/native/systemcore/Notifier.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hal/src/main/native/sim/Notifier.cpp b/hal/src/main/native/sim/Notifier.cpp index d00c33d112..1eb5c0d723 100644 --- a/hal/src/main/native/sim/Notifier.cpp +++ b/hal/src/main/native/sim/Notifier.cpp @@ -259,6 +259,7 @@ void HAL_SetNotifierAlarm(HAL_NotifierHandle notifierHandle, uint64_t alarmTime, if (ack) { notifier->handlerSignaled.clear(); + wpi::util::ResetSignalObject(notifierHandle); } if (!absolute) { @@ -291,6 +292,7 @@ void HAL_CancelNotifierAlarm(HAL_NotifierHandle notifierHandle, HAL_Bool ack, if (ack) { notifier->handlerSignaled.clear(); + wpi::util::ResetSignalObject(notifierHandle); } thr->m_alarmQueue.remove({notifierHandle, notifier}); @@ -305,6 +307,7 @@ void HAL_AcknowledgeNotifierAlarm(HAL_NotifierHandle notifierHandle, return; } notifier->handlerSignaled.clear(); + wpi::util::ResetSignalObject(notifierHandle); } int32_t HAL_GetNotifierOverrun(HAL_NotifierHandle notifierHandle, diff --git a/hal/src/main/native/systemcore/Notifier.cpp b/hal/src/main/native/systemcore/Notifier.cpp index 6e50d785e6..d798299720 100644 --- a/hal/src/main/native/systemcore/Notifier.cpp +++ b/hal/src/main/native/systemcore/Notifier.cpp @@ -185,6 +185,7 @@ void HAL_SetNotifierAlarm(HAL_NotifierHandle notifierHandle, uint64_t alarmTime, if (ack) { notifier->handlerSignaled.clear(); + wpi::util::ResetSignalObject(notifierHandle); } if (!absolute) { @@ -217,6 +218,7 @@ void HAL_CancelNotifierAlarm(HAL_NotifierHandle notifierHandle, HAL_Bool ack, if (ack) { notifier->handlerSignaled.clear(); + wpi::util::ResetSignalObject(notifierHandle); } thr->m_alarmQueue.remove({notifierHandle, notifier}); @@ -231,6 +233,7 @@ void HAL_AcknowledgeNotifierAlarm(HAL_NotifierHandle notifierHandle, return; } notifier->handlerSignaled.clear(); + wpi::util::ResetSignalObject(notifierHandle); } int32_t HAL_GetNotifierOverrun(HAL_NotifierHandle notifierHandle,