Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/36374?usp=email )
Change subject: ms: fix shutdown issues
......................................................................
ms: fix shutdown issues
Queues got stuck when killing mobile during a transfer
Change-Id: I02e668a55dece96e421c82706b76bbb411ea6712
---
M Transceiver52M/ms/itrq.h
M Transceiver52M/ms/ms_rx_lower.cpp
M Transceiver52M/ms/ms_trxcon_if.h
M Transceiver52M/ms/ms_upper.cpp
4 files changed, 20 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/74/36374/1
diff --git a/Transceiver52M/ms/itrq.h b/Transceiver52M/ms/itrq.h
index 69ff515..3ce6700 100644
--- a/Transceiver52M/ms/itrq.h
+++ b/Transceiver52M/ms/itrq.h
@@ -34,7 +34,7 @@
std::condition_variable cond_r, cond_w;
std::mutex lr, lw;
std::atomic_int r_flag, w_flag;
- const int timeout_ms = 200;
+ const int timeout_ms = 600;
public:
explicit spsc_cond_timeout_detail() : r_flag(0), w_flag(0)
diff --git a/Transceiver52M/ms/ms_rx_lower.cpp b/Transceiver52M/ms/ms_rx_lower.cpp
index b169dd8..3527a8b 100644
--- a/Transceiver52M/ms/ms_rx_lower.cpp
+++ b/Transceiver52M/ms/ms_rx_lower.cpp
@@ -54,6 +54,8 @@
#define PRINT_Q_OVERFLOW
+extern std::atomic<bool> g_exit_flag;
+
bool ms_trx::decode_sch(char *bits, bool update_global_clock)
{
int fn;
@@ -141,7 +143,7 @@
memcpy(brst.sch_bits, sch_demod_bits, sizeof(sch_demod_bits));
}
- while (upper_is_ready && !rxqueue.spsc_push(&brst))
+ while (!g_exit_flag && upper_is_ready && !rxqueue.spsc_push(&brst))
;
if (!use_agc)
diff --git a/Transceiver52M/ms/ms_trxcon_if.h b/Transceiver52M/ms/ms_trxcon_if.h
index 0928d40..14bdb4b 100644
--- a/Transceiver52M/ms/ms_trxcon_if.h
+++ b/Transceiver52M/ms/ms_trxcon_if.h
@@ -37,6 +37,6 @@
memcpy(buf, (void *)br->burst, br->burst_len);
}
};
-using tx_queue_t = spsc_cond<8 * 1, internal_q_tx_buf, true, false>;
+using tx_queue_t = spsc_cond_timeout<8 * 1, internal_q_tx_buf, true, false>;
using cmd_queue_t = spsc_cond_timeout<8 * 1, trxcon_phyif_cmd, true, false>;
-using cmdr_queue_t = spsc_cond<8 * 1, trxcon_phyif_rsp, false, false>;
+using cmdr_queue_t = spsc_cond_timeout<8 * 1, trxcon_phyif_rsp, false, false>;
diff --git a/Transceiver52M/ms/ms_upper.cpp b/Transceiver52M/ms/ms_upper.cpp
index af5bf82..c86029c 100644
--- a/Transceiver52M/ms/ms_upper.cpp
+++ b/Transceiver52M/ms/ms_upper.cpp
@@ -172,9 +172,11 @@
std::fill(workbuf, workbuf + workbuf_size, 0);
// assert(sv.begin() == &workbuf[40]);
- while (!rxqueue.spsc_pop(&e)) {
+ while (!rxqueue.spsc_pop(&e) && !g_exit_flag) {
rxqueue.spsc_prep_pop();
}
+ if (g_exit_flag)
+ return false;
wTime = e.gsmts;
--
To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/36374?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I02e668a55dece96e421c82706b76bbb411ea6712
Gerrit-Change-Number: 36374
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-MessageType: newchange