ms: fix shutdown issues

Queues got stuck when killing mobile during a transfer

Change-Id: I02e668a55dece96e421c82706b76bbb411ea6712
This commit is contained in:
Eric Wild 2024-03-20 19:39:05 +01:00
parent b440b7024c
commit 98bc468d72
4 changed files with 9 additions and 5 deletions

View File

@ -34,7 +34,7 @@ class spsc_cond_timeout_detail {
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)

View File

@ -54,6 +54,8 @@ extern "C" {
#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 @@ bool ms_trx::handle_sch_or_nb()
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)

View File

@ -37,6 +37,6 @@ struct internal_q_tx_buf {
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>;

View File

@ -172,9 +172,11 @@ bool upper_trx::pullRadioVector(GSM::Time &wTime, int &RSSI, int &timingOffset)
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;