intra_measure_base: fix race detected with TSAN

use mutex to protect state getters
This commit is contained in:
Andre Puschmann 2021-05-28 09:48:19 +02:00
parent f43e82a8a6
commit d2ec3ca5e1
1 changed files with 6 additions and 2 deletions

View File

@ -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<std::mutex> 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);