From 14267640eef53df50dc560d09689519ff877b3ae Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 17 Sep 2019 12:54:12 +0100 Subject: [PATCH] implemented andre's PR review requests --- lib/include/srslte/common/multiqueue.h | 2 +- srsue/src/stack/ue_stack_lte.cc | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/include/srslte/common/multiqueue.h b/lib/include/srslte/common/multiqueue.h index 5b4c46be0..32e26beb9 100644 --- a/lib/include/srslte/common/multiqueue.h +++ b/lib/include/srslte/common/multiqueue.h @@ -221,7 +221,7 @@ private: uint32_t spin_idx = 0; bool running = true; std::vector queues; - uint32_t capacity; + uint32_t capacity = 0; uint32_t nof_threads_waiting = 0; }; diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 15e2d3082..e8fd0e72e 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -207,7 +207,7 @@ bool ue_stack_lte::get_metrics(stack_metrics_t* metrics) void ue_stack_lte::run_thread() { while (running) { - task_t task; + task_t task{}; pending_tasks.wait_pop(&task); task(); } @@ -229,10 +229,13 @@ void ue_stack_lte::run_thread() */ void ue_stack_lte::write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking) { - task_t task; + task_t task{}; task.pdu = std::move(sdu); task.func = [this, lcid, blocking](task_t* task_ctxt) { pdcp.write_sdu(lcid, std::move(task_ctxt->pdu), blocking); }; - pending_tasks.try_push(gw_queue_id, std::move(task)); + std::pair ret = pending_tasks.try_push(gw_queue_id, std::move(task)); + if (not ret.first) { + pdcp_log.warning("GW SDU with lcid=%d was discarded.\n", lcid); + } } /******************** @@ -244,17 +247,17 @@ void ue_stack_lte::write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bo */ void ue_stack_lte::in_sync() { - pending_tasks.try_push(sync_queue_id, task_t{[this](task_t*) { rrc.in_sync(); }}); + pending_tasks.push(sync_queue_id, task_t{[this](task_t*) { rrc.in_sync(); }}); } void ue_stack_lte::out_of_sync() { - pending_tasks.try_push(sync_queue_id, task_t{[this](task_t*) { rrc.out_of_sync(); }}); + pending_tasks.push(sync_queue_id, task_t{[this](task_t*) { rrc.out_of_sync(); }}); } void ue_stack_lte::run_tti(uint32_t tti) { - pending_tasks.try_push(sync_queue_id, task_t{[this, tti](task_t*) { run_tti_impl(tti); }}); + pending_tasks.push(sync_queue_id, task_t{[this, tti](task_t*) { run_tti_impl(tti); }}); } void ue_stack_lte::run_tti_impl(uint32_t tti)