ms: fix shutdown issues
Queues got stuck when killing mobile during a transfer Change-Id: I02e668a55dece96e421c82706b76bbb411ea6712
This commit is contained in:
parent
c134da56d2
commit
5a31518a5c
|
@ -34,7 +34,7 @@ class spsc_cond_timeout_detail {
|
||||||
std::condition_variable cond_r, cond_w;
|
std::condition_variable cond_r, cond_w;
|
||||||
std::mutex lr, lw;
|
std::mutex lr, lw;
|
||||||
std::atomic_int r_flag, w_flag;
|
std::atomic_int r_flag, w_flag;
|
||||||
const int timeout_ms = 200;
|
const int timeout_ms = 600;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit spsc_cond_timeout_detail() : r_flag(0), w_flag(0)
|
explicit spsc_cond_timeout_detail() : r_flag(0), w_flag(0)
|
||||||
|
|
|
@ -54,6 +54,8 @@ extern "C" {
|
||||||
|
|
||||||
#define PRINT_Q_OVERFLOW
|
#define PRINT_Q_OVERFLOW
|
||||||
|
|
||||||
|
extern std::atomic<bool> g_exit_flag;
|
||||||
|
|
||||||
bool ms_trx::decode_sch(char *bits, bool update_global_clock)
|
bool ms_trx::decode_sch(char *bits, bool update_global_clock)
|
||||||
{
|
{
|
||||||
int fn;
|
int fn;
|
||||||
|
@ -141,7 +143,7 @@ bool ms_trx::handle_sch_or_nb()
|
||||||
memcpy(brst.sch_bits, sch_demod_bits, sizeof(sch_demod_bits));
|
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)
|
if (!use_agc)
|
||||||
|
|
|
@ -37,6 +37,6 @@ struct internal_q_tx_buf {
|
||||||
memcpy(buf, (void *)br->burst, br->burst_len);
|
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 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>;
|
||||||
|
|
|
@ -172,9 +172,11 @@ bool upper_trx::pullRadioVector(GSM::Time &wTime, int &RSSI, int &timingOffset)
|
||||||
std::fill(workbuf, workbuf + workbuf_size, 0);
|
std::fill(workbuf, workbuf + workbuf_size, 0);
|
||||||
// assert(sv.begin() == &workbuf[40]);
|
// assert(sv.begin() == &workbuf[40]);
|
||||||
|
|
||||||
while (!rxqueue.spsc_pop(&e)) {
|
while (!rxqueue.spsc_pop(&e) && !g_exit_flag) {
|
||||||
rxqueue.spsc_prep_pop();
|
rxqueue.spsc_prep_pop();
|
||||||
}
|
}
|
||||||
|
if (g_exit_flag)
|
||||||
|
return false;
|
||||||
|
|
||||||
wTime = e.gsmts;
|
wTime = e.gsmts;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue