diff --git a/srsue/hdr/stack/ue_stack_lte.h b/srsue/hdr/stack/ue_stack_lte.h index 492dd2bf4..70de8bb22 100644 --- a/srsue/hdr/stack/ue_stack_lte.h +++ b/srsue/hdr/stack/ue_stack_lte.h @@ -115,8 +115,8 @@ public: private: void run_thread() final; - void run_tti_(uint32_t tti); - void stop_(); + void run_tti_impl(uint32_t tti); + void stop_impl(); bool running; srsue::stack_args_t args; diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 4c1034e2f..c1f05d46e 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -116,34 +116,28 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_) void ue_stack_lte::stop() { if (running) { - pending_tasks.push([this]() { stop_(); }); + pending_tasks.push([this]() { stop_impl(); }); + running = false; wait_thread_finish(); } } -void ue_stack_lte::stop_() +void ue_stack_lte::stop_impl() { - if (running) { - usim->stop(); - nas.stop(); - rrc.stop(); - - // Caution here order of stop is very important to avoid locks + usim->stop(); + nas.stop(); + rrc.stop(); - // Stop RLC and PDCP before GW to avoid locking on queue - rlc.stop(); - pdcp.stop(); - mac.stop(); - - if (args.pcap.enable) { - mac_pcap.close(); - } - if (args.pcap.nas_enable) { - nas_pcap.close(); - } + rlc.stop(); + pdcp.stop(); + mac.stop(); - running = false; + if (args.pcap.enable) { + mac_pcap.close(); + } + if (args.pcap.nas_enable) { + nas_pcap.close(); } } @@ -217,10 +211,10 @@ void ue_stack_lte::out_of_sync() void ue_stack_lte::run_tti(uint32_t tti) { - pending_tasks.push([this, tti]() { run_tti_(tti); }); + pending_tasks.push([this, tti]() { run_tti_impl(tti); }); } -void ue_stack_lte::run_tti_(uint32_t tti) +void ue_stack_lte::run_tti_impl(uint32_t tti) { mac.run_tti(tti); rrc.run_tti(tti); diff --git a/srsue/test/upper/nas_test.cc b/srsue/test/upper/nas_test.cc index ffe808084..ae65f5e4b 100644 --- a/srsue/test/upper/nas_test.cc +++ b/srsue/test/upper/nas_test.cc @@ -148,14 +148,7 @@ public: pdcp->write_sdu(lcid, std::move(sdu), blocking); } bool is_lcid_enabled(uint32_t lcid) { return pdcp->is_lcid_enabled(lcid); } - void run_thread() - { - running = true; - uint32_t counter = 0; - // while (running) { - // nas->run_tti(counter++); - // } - } + void run_thread() { running = true; } void stop() { running = false;