stack: fix issue where stack thread was exited before stop_impl was called

master
Andre Puschmann 6 years ago
parent 58763fb714
commit 1dea4add2a

@ -171,6 +171,8 @@ private:
mac_metrics_t metrics[SRSLTE_MAX_CARRIERS] = {}; mac_metrics_t metrics[SRSLTE_MAX_CARRIERS] = {};
bool initialized = false;
/* Class to process MAC PDUs from DEMUX unit */ /* Class to process MAC PDUs from DEMUX unit */
class pdu_process : public thread { class pdu_process : public thread {
public: public:

@ -88,14 +88,18 @@ bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface
reset(); reset();
initialized = true;
return true; return true;
} }
void mac::stop() void mac::stop()
{ {
pdu_process_thread.stop(); if (initialized) {
pdu_process_thread.stop();
run_tti(0); // make sure it's not locked after last TTI run_tti(0); // make sure it's not locked after last TTI
initialized = false;
}
} }
void mac::start_pcap(srslte::mac_pcap* pcap_) void mac::start_pcap(srslte::mac_pcap* pcap_)

@ -130,14 +130,14 @@ void ue_stack_lte::stop()
{ {
if (running) { if (running) {
pending_tasks.push([this]() { stop_impl(); }); pending_tasks.push([this]() { stop_impl(); });
running = false;
wait_thread_finish(); wait_thread_finish();
} }
} }
void ue_stack_lte::stop_impl() void ue_stack_lte::stop_impl()
{ {
running = false;
usim->stop(); usim->stop();
nas.stop(); nas.stop();
rrc.stop(); rrc.stop();

Loading…
Cancel
Save