From ee6b846acc2e9a63981b3ed1d66a799c58559053 Mon Sep 17 00:00:00 2001 From: Bryant Jones Date: Tue, 3 Nov 2026 19:16:15 -0500 Subject: [PATCH] Driver: Fix lost wakeup in pushRx --- communication/driver.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/communication/driver.cpp b/communication/driver.cpp index c71d29b7..5fc7d390 100644 --- a/communication/driver.cpp +++ b/communication/driver.cpp @@ -9,7 +9,13 @@ using namespace icsneo; bool Driver::pushRx(const uint8_t* buf, size_t numReceived) { - bool ret = readBuffer.write(buf, numReceived); + bool ret; + { + // Write under the lock waitForRx checks its predicate with, or a notify between that check and + // the wait is lost and the reader sleeps the full timeout (1s for the read task) with data ready + std::lock_guard lk(rxWaitMutex); + ret = readBuffer.write(buf, numReceived); + } rxWaitCv.notify_all();