diff options
Diffstat (limited to 'Transceiver52M/radioInterface.cpp')
-rw-r--r-- | Transceiver52M/radioInterface.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index 6e49a75..fbcacf1 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -24,6 +24,7 @@ #include "radioInterface.h" #include "Resampler.h" #include <Logger.h> +#include <Threads.h> extern "C" { #include "convert.h" @@ -288,9 +289,9 @@ int RadioInterface::driveReceiveRadio() bool RadioInterface::isUnderrun() { - bool retVal = underrun; - underrun = false; - + bool retVal; + /* atomically get previous value of "underrun" and set the var to false */ + retVal = osmo_trx_sync_fetch_and_and(&underrun, false); return retVal; } @@ -340,7 +341,7 @@ int RadioInterface::pullBuffer() segmentLen * 2); } - underrun |= local_underrun; + osmo_trx_sync_or_and_fetch(&underrun, local_underrun); readTimestamp += numRecv; return 0; } @@ -366,7 +367,7 @@ bool RadioInterface::pushBuffer() segmentLen, &local_underrun, writeTimestamp); - underrun |= local_underrun; + osmo_trx_sync_or_and_fetch(&underrun, local_underrun); writeTimestamp += numSent; return true; |