From b7ea481bf98e91bf665f1273d7428b19ba0d2b39 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Fri, 4 May 2018 21:29:42 -0400 Subject: [PATCH] Notifier: reset updatedAlarm before waiting (#946) - If this isn't done, then the wait will always be performed at least twice --- hal/src/main/native/sim/Notifier.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hal/src/main/native/sim/Notifier.cpp b/hal/src/main/native/sim/Notifier.cpp index f975a58c0a..622c00bde2 100644 --- a/hal/src/main/native/sim/Notifier.cpp +++ b/hal/src/main/native/sim/Notifier.cpp @@ -136,6 +136,9 @@ uint64_t HAL_WaitForNotifierAlarm(HAL_NotifierHandle notifierHandle, waitTime = notifier->waitTime * 1e-6; } + // Don't wait twice + notifier->updatedAlarm = false; + auto timeoutTime = hal::fpga_clock::epoch() + std::chrono::duration(waitTime); notifier->cond.wait_until(lock, timeoutTime);