From a2c433b2287b581ae2754433030008f7f276a54a Mon Sep 17 00:00:00 2001 From: faluco Date: Fri, 1 Oct 2021 13:49:14 +0200 Subject: [PATCH] Fix data race in the enb::mac::ue metrics object. --- srsenb/src/stack/mac/ue.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index 791b08725..719760bf9 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -108,7 +108,7 @@ uint8_t* cc_used_buffers_map::request_pdu(tti_point tti, uint32_t len) void cc_used_buffers_map::clear_old_pdus(tti_point current_tti) { std::unique_lock lock(mutex); - static const uint32_t old_tti_threshold = SRSRAN_FDD_NOF_HARQ + 4; + static const uint32_t old_tti_threshold = SRSRAN_FDD_NOF_HARQ + 4; tti_point max_tti{current_tti - old_tti_threshold}; for (auto& pdu_pair : pdu_map) { @@ -205,7 +205,10 @@ ue::~ue() {} void ue::reset() { - ue_metrics = {}; + { + std::lock_guard lock(metrics_mutex); + ue_metrics = {}; + } nof_failures = 0; for (auto& cc : cc_buffers) {