From d2ec3ca5e1dbeb0636640e2fce7c80e8b6ba192e Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 28 May 2021 09:48:19 +0200 Subject: [PATCH] intra_measure_base: fix race detected with TSAN use mutex to protect state getters --- srsue/hdr/phy/scell/intra_measure_base.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/srsue/hdr/phy/scell/intra_measure_base.h b/srsue/hdr/phy/scell/intra_measure_base.h index df6cd2a0e..e4836d71b 100644 --- a/srsue/hdr/phy/scell/intra_measure_base.h +++ b/srsue/hdr/phy/scell/intra_measure_base.h @@ -188,7 +188,11 @@ private: * @brief Get the internal state * @return protected state */ - state_t get_state() const { return state; } + state_t get_state() + { + std::lock_guard lock(mutex); + return state; + } /** * @brief Transitions to a different state, all transitions are allowed except from quit @@ -221,7 +225,7 @@ private: /** * @brief Computes the measurement trigger based on TTI and the last TTI trigger */ - bool receive_tti_trigger(uint32_t tti) const + bool receive_tti_trigger(uint32_t tti) { // If the elapsed time does not satisfy with the minimum time, do not trigger uint32_t elapsed_tti = TTI_SUB(tti, last_measure_tti);