From d7e8d6bf652b4a482256f4afaa7efd3b54dfa333 Mon Sep 17 00:00:00 2001 From: faluco Date: Wed, 20 Oct 2021 12:52:17 +0200 Subject: [PATCH] Fix data race in mux_nr::add_bsr_ce. --- srsue/hdr/stack/mac_nr/mux_nr.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/srsue/hdr/stack/mac_nr/mux_nr.h b/srsue/hdr/stack/mac_nr/mux_nr.h index c4bf9e4d4..5356cc08b 100644 --- a/srsue/hdr/stack/mac_nr/mux_nr.h +++ b/srsue/hdr/stack/mac_nr/mux_nr.h @@ -30,7 +30,7 @@ class mux_nr final : mux_base, public mux_interface_bsr_nr public: explicit mux_nr(mac_interface_mux_nr& mac_, srslog::basic_logger& logger); ~mux_nr(){}; - void reset(); + void reset(); int32_t init(rlc_interface_mac* rlc_); void msg3_flush(); @@ -53,9 +53,9 @@ private: // internal helper methods // ctor configured members - mac_interface_mux_nr& mac; - rlc_interface_mac* rlc = nullptr; - srslog::basic_logger& logger; + mac_interface_mux_nr& mac; + rlc_interface_mac* rlc = nullptr; + srslog::basic_logger& logger; // Msg3 related srsran::unique_byte_buffer_t msg3_buff = nullptr; @@ -69,7 +69,8 @@ private: srsran::mac_sch_pdu_nr tx_pdu; /// single MAC PDU for packing - enum { no_bsr, sbsr_ce, lbsr_ce } add_bsr_ce = no_bsr; /// BSR procedure requests MUX to add a BSR CE + enum bsr_req_t { no_bsr, sbsr_ce, lbsr_ce }; + std::atomic add_bsr_ce = {bsr_req_t::no_bsr}; /// BSR procedure requests MUX to add a BSR CE // Mutex for exclusive access std::mutex mutex;