aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/usrp_cal_utils.hpp
diff options
context:
space:
mode:
authorAaron Rossetto <aaron.rossetto@ni.com>2021-08-02 10:57:12 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-08-04 06:56:39 -0500
commitcd0adcd43a6067ca8c9b717bc5d5d26f79738183 (patch)
tree54a9f6986fc08bd46a861a8cc97729173d93383c /host/utils/usrp_cal_utils.hpp
parentbb264b812a1b308bb73fb404cab3a90db30ca7c7 (diff)
downloaduhd-cd0adcd43a6067ca8c9b717bc5d5d26f79738183.tar.gz
uhd-cd0adcd43a6067ca8c9b717bc5d5d26f79738183.tar.bz2
uhd-cd0adcd43a6067ca8c9b717bc5d5d26f79738183.zip
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.
Diffstat (limited to 'host/utils/usrp_cal_utils.hpp')
-rw-r--r--host/utils/usrp_cal_utils.hpp2
1 files changed, 1 insertions, 1 deletions
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());