utils: remove thread priority elevation

Remove UHD call to elevate thread priority to realtime from utils, and
add warning in documentation of set_thread_priority function. Setting
all threads to the same realtime priority can cause the threads to not
share access to the network interface fairly, which adversely affects
operation of the worker threads in UHD.
This commit is contained in:
Ciro Nishiguchi 2019-08-06 14:44:51 -05:00 committed by Martin Braun
parent 9863161320
commit 1c79742231
7 changed files with 4 additions and 14 deletions

View File

@ -20,8 +20,10 @@ static const float default_thread_priority = float(0.5);
/*!
* Set the scheduling priority on the current thread.
*
* A new thread or calling process should make this call
* with the defaults this to enable realtime scheduling.
* To enable realtime scheduling on a new thread, call this function with
* the default values. Warning: realtime scheduling can cause UHD worker
* threads to not share resources such as network interfaces fairly,
* potentially causing it to malfunction.
*
* A priority of zero corresponds to normal priority.
* Positive priority values are higher than normal.

View File

@ -319,8 +319,6 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
return EXIT_FAILURE;
}
uhd::set_thread_priority_safe();
const char* formats[] = {"sc16", "fc32", "fc64"};
constexpr size_t rx_spp = 2000;
constexpr size_t tx_spp = 1000;

View File

@ -82,8 +82,6 @@ int query_clock_sensors(const std::string& args)
int UHD_SAFE_MAIN(int argc, char* argv[])
{
uhd::set_thread_priority_safe();
std::string args;
// Set up program options

View File

@ -32,8 +32,6 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp,
uhd::tx_streamer::sptr tx_stream,
const double tx_wave_ampl)
{
uhd::set_thread_priority_safe();
// set max TX gain
usrp->set_tx_gain(usrp->get_tx_gain_range().stop());

View File

@ -31,8 +31,6 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp,
const double tx_wave_freq,
const double tx_wave_ampl)
{
uhd::set_thread_priority_safe();
// set max TX gain
usrp->set_tx_gain(usrp->get_tx_gain_range().stop());

View File

@ -28,8 +28,6 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp,
const double tx_wave_freq,
const double tx_wave_ampl)
{
uhd::set_thread_priority_safe();
// set max TX gain
usrp->set_tx_gain(usrp->get_tx_gain_range().stop());

View File

@ -1037,8 +1037,6 @@ std::vector<size_t> get_channels(const std::string& channel_list, size_t max = -
* Main code + dispatcher
**********************************************************************/
int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::set_thread_priority_safe();
//variables to be set by po
std::string args;
double duration;