mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-11-04 04:49:07 +01:00
Driver: Fix lost wakeup in pushRx
This commit is contained in:
committed by
Kyle Schwarz
parent
645549193d
commit
ee6b846acc
@@ -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<std::mutex> lk(rxWaitMutex);
|
||||
ret = readBuffer.write(buf, numReceived);
|
||||
}
|
||||
|
||||
rxWaitCv.notify_all();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user