lib,rf_imp: load rf plugins when loading this library

This fixes race of concurrently loading the same plugins
when srsran_rf_open_devname is called by multiple threads

Plugins are now loaded when srsran_rf is loaded (for
shared lib) or right before main() (for static lib)
master
Robert Falkenberg 3 years ago
parent e6f42331ba
commit a5c61418d5

@ -94,11 +94,6 @@ const char* srsran_rf_get_devname(srsran_rf_t* rf)
int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uint32_t nof_channels)
{
if (srsran_rf_load_plugins() != SRSRAN_SUCCESS) {
ERROR("Failed to load RF plugins");
return SRSRAN_ERROR;
}
rf->thread_gain_run = false;
bool no_rf_devs_detected = true;
@ -482,3 +477,11 @@ int srsran_rf_load_plugins()
#endif /* ENABLE_RF_PLUGINS */
return SRSRAN_SUCCESS;
}
// Search and load plugins when this library is loaded (shared) or right before main (static)
void __attribute__((constructor)) init()
{
if (srsran_rf_load_plugins() != SRSRAN_SUCCESS) {
ERROR("Failed to load RF plugins");
}
}

@ -233,7 +233,6 @@ int param_test(const char* args_param, const int num_channels)
int main()
{
srsran_rf_load_plugins();
// // two Rx ports
// if (param_test("rx_port=ipc://dl0,rx_port1=ipc://dl1", 2)) {
// fprintf(stderr, "Param test failed!\n");

Loading…
Cancel
Save