From cd0adcd43a6067ca8c9b717bc5d5d26f79738183 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Mon, 2 Aug 2021 10:57:12 -0500 Subject: cal: Use safe version of set_thread_priority() The calibration utilities attempt to bump the transmit thread priority to realtime to prevent underruns. However, on platforms that use pthread, `pthread_setschedparam()` typically requires elevated privileges. When called without those privileges, the code path throws an exception that is left unhandled, thus terminating the process with an unhelpful error message. This commit changes the thread priority function call to use a safe version which catches any exceptions thrown by `pthread_setschedparam()` and prints a much more instructive error message without terminating the process. This gives the user a fighting chance to correct the issue and successfully use the calibration utilities. --- host/utils/usrp_cal_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/utils') diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 3750be9cb..4cb375161 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -357,7 +357,7 @@ static void tx_thread(std::atomic_flag* transmit, const double tx_wave_ampl) { // increase thread priority for TX to prevent underruns - uhd::set_thread_priority(); + uhd::set_thread_priority_safe(); // set max TX gain usrp->set_tx_gain(usrp->get_tx_gain_range().stop()); -- cgit v1.2.3