mirror of https://github.com/PentHertz/srsLTE.git
Fix a data race when passing the nr_workers to the txrx worker.
There was an unprotected access of the txrx reading this variable while being set from a different thread. Fix it by starting the txrx thread after all variables are ready.
This commit is contained in:
parent
00a6e71f50
commit
a703279975
|
@ -38,13 +38,13 @@ public:
|
|||
int init(const phy_args_t& args,
|
||||
const phy_cfg_t& cfg,
|
||||
srsran::radio_interface_phy* radio_,
|
||||
stack_interface_phy_lte* stack_,
|
||||
stack_interface_phy_lte* stack_lte_,
|
||||
stack_interface_phy_nr& stack_nr_,
|
||||
enb_time_interface* enb_);
|
||||
int init(const phy_args_t& args,
|
||||
const phy_cfg_t& cfg,
|
||||
srsran::radio_interface_phy* radio_,
|
||||
stack_interface_phy_lte* stack_lte_,
|
||||
stack_interface_phy_nr& stack_nr_,
|
||||
stack_interface_phy_lte* stack_,
|
||||
enb_time_interface* enb_);
|
||||
void stop() override;
|
||||
|
||||
|
@ -72,7 +72,6 @@ public:
|
|||
|
||||
void srsran_phy_logger(phy_logger_level_t log_level, char* str);
|
||||
|
||||
int init_nr(const phy_args_t& args, const phy_cfg_t& cfg, stack_interface_phy_nr& stack);
|
||||
int set_common_cfg(const common_cfg_t& common_cfg) override;
|
||||
|
||||
private:
|
||||
|
@ -103,6 +102,12 @@ private:
|
|||
common_cfg_t common_cfg = {};
|
||||
|
||||
void parse_common_config(const phy_cfg_t& cfg);
|
||||
int init_lte(const phy_args_t& args,
|
||||
const phy_cfg_t& cfg,
|
||||
srsran::radio_interface_phy* radio_,
|
||||
stack_interface_phy_lte* stack_,
|
||||
enb_time_interface* enb_);
|
||||
int init_nr(const phy_args_t& args, const phy_cfg_t& cfg, stack_interface_phy_nr& stack);
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
|
|
@ -100,7 +100,7 @@ int phy::init(const phy_args_t& args,
|
|||
stack_interface_phy_nr& stack_nr_,
|
||||
enb_time_interface* enb_)
|
||||
{
|
||||
if (init(args, cfg, radio_, stack_lte_, enb_) != SRSRAN_SUCCESS) {
|
||||
if (init_lte(args, cfg, radio_, stack_lte_, enb_) != SRSRAN_SUCCESS) {
|
||||
phy_log.error("Couldn't initialize LTE PHY");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
@ -110,6 +110,9 @@ int phy::init(const phy_args_t& args,
|
|||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
tx_rx.init(enb_, radio, <e_workers, &workers_common, &prach, SF_RECV_THREAD_PRIO);
|
||||
initialized = true;
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -118,6 +121,23 @@ int phy::init(const phy_args_t& args,
|
|||
srsran::radio_interface_phy* radio_,
|
||||
stack_interface_phy_lte* stack_lte_,
|
||||
enb_time_interface* enb_)
|
||||
{
|
||||
if (init_lte(args, cfg, radio_, stack_lte_, enb_) != SRSRAN_SUCCESS) {
|
||||
phy_log.error("Couldn't initialize LTE PHY");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
tx_rx.init(enb_, radio, <e_workers, &workers_common, &prach, SF_RECV_THREAD_PRIO);
|
||||
initialized = true;
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
int phy::init_lte(const phy_args_t& args,
|
||||
const phy_cfg_t& cfg,
|
||||
srsran::radio_interface_phy* radio_,
|
||||
stack_interface_phy_lte* stack_lte_,
|
||||
enb_time_interface* enb_)
|
||||
{
|
||||
if (cfg.phy_cell_cfg.size() > SRSRAN_MAX_CARRIERS) {
|
||||
phy_log.error(
|
||||
|
@ -166,11 +186,6 @@ int phy::init(const phy_args_t& args,
|
|||
}
|
||||
prach.set_max_prach_offset_us(args.max_prach_offset_us);
|
||||
|
||||
// Warning this must be initialized after all workers have been added to the pool
|
||||
tx_rx.init(enb_, radio, <e_workers, &workers_common, &prach, SF_RECV_THREAD_PRIO);
|
||||
|
||||
initialized = true;
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue