Fix data race in proc_sr_nr.

master
faluco 3 years ago committed by faluco
parent dfc2ea0a3e
commit dfd16718fe

@ -45,8 +45,11 @@ void proc_sr_nr::reset_nolock()
int32_t proc_sr_nr::set_config(const srsran::sr_cfg_nr_t& cfg_) int32_t proc_sr_nr::set_config(const srsran::sr_cfg_nr_t& cfg_)
{ {
// disable by default {
cfg.enabled = false; std::lock_guard<std::mutex> lock(mutex);
// disable by default
cfg.enabled = false;
}
if (cfg_.num_items != 1) { if (cfg_.num_items != 1) {
logger.error("Only one SR config supported. Disabling SR."); logger.error("Only one SR config supported. Disabling SR.");
@ -69,8 +72,11 @@ int32_t proc_sr_nr::set_config(const srsran::sr_cfg_nr_t& cfg_)
logger.info("SR: Disabling procedure"); logger.info("SR: Disabling procedure");
} }
// store config {
cfg = cfg_; std::lock_guard<std::mutex> lock(mutex);
// store config
cfg = cfg_;
}
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

Loading…
Cancel
Save