From d089653bd20977ec3fb9ba774c05dc4e488391b2 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 19 Jan 2022 13:11:22 +0100 Subject: [PATCH] Fix concurrent access in UE NR PHY clear pending states --- srsue/hdr/phy/nr/state.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/srsue/hdr/phy/nr/state.h b/srsue/hdr/phy/nr/state.h index c3f51d2e9..b1f168522 100644 --- a/srsue/hdr/phy/nr/state.h +++ b/srsue/hdr/phy/nr/state.h @@ -303,13 +303,20 @@ public: void clear_pending_grants() { - // Scope mutex to protect read/write the list - std::lock_guard lock(pending_ul_grant_mutex); - // Clear all PDSCH assignments and PUSCH grants - pending_dl_grant = {}; - pending_ul_grant = {}; - pending_ack = {}; + // Scope mutex to protect read/write each list + { + std::lock_guard lock(pending_ul_grant_mutex); + pending_ul_grant = {}; + } + { + std::lock_guard lock(pending_dl_grant_mutex); + pending_dl_grant = {}; + } + { + std::lock_guard lock(pending_ack_mutex); + pending_ack = {}; + } } void get_pending_sr(const srsran::phy_cfg_nr_t& cfg, const uint32_t& tti, srsran_uci_data_nr_t& uci_data)