skiq: allow running without root permissions

do what the comment says, when thread can't be created with privelages,
try to create it without them.
This commit is contained in:
Andre Puschmann 2021-11-07 22:36:55 +01:00
parent 8d33d93c77
commit 085d561f65
2 changed files with 14 additions and 2 deletions

View File

@ -209,7 +209,13 @@ int rf_skiq_card_init(rf_skiq_card_t* q, uint8_t card, uint8_t nof_ports, const
// Launch thread
if (pthread_create(&q->thread, &attr, reader_thread, q)) {
ERROR("Error creating reader thread with attributes (Did you miss sudo?). Trying without attributes.\n");
return SRSRAN_ERROR;
// try to create thread without attributes
pthread_attr_destroy(&attr);
if (pthread_create(&q->thread, NULL, reader_thread, q)) {
ERROR("Error creating reader thread, even without thread attributes. Exiting.\n");
return SRSRAN_ERROR;
}
}
// Rename thread

View File

@ -222,7 +222,13 @@ int rf_skiq_tx_port_init(rf_skiq_tx_port_t* q, uint8_t card, skiq_tx_hdl_t hdl,
// Launch thread
if (pthread_create(&q->thread, &attr, writer_thread, q)) {
ERROR("Error creating writer thread with attributes (Did you miss sudo?). Trying without attributes.\n");
return SRSRAN_ERROR;
// try to create thread without attributes
pthread_attr_destroy(&attr);
if (pthread_create(&q->thread, NULL, writer_thread, q)) {
ERROR("Error creating writer thread, even without thread attributes. Exiting.\n");
return SRSRAN_ERROR;
}
}
// Rename thread