diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-09-13 18:56:08 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-09-20 19:17:22 +0200 |
commit | e503c988d825e0eaf5f56ed8dd68b318b3e43c04 (patch) | |
tree | 85527c3ea1f78c35eaf02df1c0584f16a88d9511 /Transceiver52M/osmo-trx.cpp | |
parent | ee2ba19cec96347d11e3661077ef3c4c0eb068c2 (diff) |
radioInterface: Atomically fetch and change underrun variable
Otherwise, it could happen that underrun events are lost:
TxLower (isUnderrun): RxLower (pullBuffer):
read(underrun)
read(underrun)
write(underrun, |val) [maybe underrun becomes TRUE]
write(underrun, false)
Similary, it could happen the other direction if atomic was only applied
to isUnderrun:
TxLower (isUnderrun): RxLower (pullBuffer):
read(underrun) -> true
read(underrun)-> true
write(underrun, false)
write(underrun, true|val) where val=false
So in here isUnderrun would return true twice while it should only
return one.
Change-Id: I684e0a5d2a9583a161d5a6593559b3a9e7cd57e3
Diffstat (limited to 'Transceiver52M/osmo-trx.cpp')
-rw-r--r-- | Transceiver52M/osmo-trx.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index ab0b631..9fe6585 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -571,6 +571,11 @@ int main(int argc, char *argv[]) #endif #endif +#ifndef HAVE_ATOMIC_OPS +#pragma message ("Built without atomic operation support. Using Mutex, it may affect performance!") + printf("Built without atomic operation support. Using Mutex, it may affect performance!\n"); +#endif + if (!log_mutex_init()) { fprintf(stderr, "Failed to initialize log mutex!\n"); exit(2); |