diff options
Diffstat (limited to 'host/examples')
| -rw-r--r-- | host/examples/network_relay.cpp | 4 | ||||
| -rw-r--r-- | host/examples/rx_ascii_art_dft.cpp | 5 | ||||
| -rw-r--r-- | host/examples/rx_multi_samples.cpp | 7 | ||||
| -rw-r--r-- | host/examples/rx_samples_to_udp.cpp | 5 | ||||
| -rw-r--r-- | host/examples/sync_to_gps.cpp | 11 | ||||
| -rw-r--r-- | host/examples/test_clock_synch.cpp | 15 | ||||
| -rw-r--r-- | host/examples/test_dboard_coercion.cpp | 11 | ||||
| -rw-r--r-- | host/examples/test_pps_input.cpp | 5 | ||||
| -rw-r--r-- | host/examples/tx_waveforms.cpp | 9 | 
9 files changed, 41 insertions, 31 deletions
| diff --git a/host/examples/network_relay.cpp b/host/examples/network_relay.cpp index f450326d6..8f7e180da 100644 --- a/host/examples/network_relay.cpp +++ b/host/examples/network_relay.cpp @@ -16,6 +16,8 @@  #include <csignal>  #include <vector>  #include <cstdlib> +#include <chrono> +#include <thread>  namespace po = boost::program_options;  namespace asio = boost::asio; @@ -205,7 +207,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          std::cout << "Press Ctrl + C to stop streaming..." << std::endl;          while (not stop_signal_called){ -            boost::this_thread::sleep(boost::posix_time::milliseconds(100)); +            std::this_thread::sleep_for(std::chrono::milliseconds(100));          }      } diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp index 72b37d720..26c84f52b 100644 --- a/host/examples/rx_ascii_art_dft.cpp +++ b/host/examples/rx_ascii_art_dft.cpp @@ -10,12 +10,13 @@  #include <uhd/usrp/multi_usrp.hpp>  #include "ascii_art_dft.hpp" //implementation  #include <boost/program_options.hpp> -#include <boost/thread/thread.hpp> //gets time  #include <boost/format.hpp>  #include <curses.h>  #include <iostream>  #include <complex>  #include <cstdlib> +#include <chrono> +#include <thread>  namespace po = boost::program_options; @@ -108,7 +109,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      //set the antenna      if (vm.count("ant")) usrp->set_rx_antenna(ant); -    boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time +    std::this_thread::sleep_for(std::chrono::seconds(1)); //allow for some setup time      //Check Ref and LO Lock detect      std::vector<std::string> sensor_names; diff --git a/host/examples/rx_multi_samples.cpp b/host/examples/rx_multi_samples.cpp index 9b4527c9a..7e6e7240a 100644 --- a/host/examples/rx_multi_samples.cpp +++ b/host/examples/rx_multi_samples.cpp @@ -10,10 +10,11 @@  #include <uhd/usrp/multi_usrp.hpp>  #include <boost/program_options.hpp>  #include <boost/format.hpp> -#include <boost/thread.hpp>  #include <boost/algorithm/string.hpp>  #include <iostream>  #include <complex> +#include <chrono> +#include <thread>  namespace po = boost::program_options; @@ -86,7 +87,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      else if (sync == "pps"){          usrp->set_time_source("external");          usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); -        boost::this_thread::sleep(boost::posix_time::seconds(1)); //wait for pps sync pulse +        std::this_thread::sleep_for(std::chrono::seconds(1)); //wait for pps sync pulse      }      else if (sync == "mimo"){          UHD_ASSERT_THROW(usrp->get_num_mboards() == 2); @@ -99,7 +100,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          usrp->set_time_now(uhd::time_spec_t(0.0), 0);          //sleep a bit while the slave locks its time to the master -        boost::this_thread::sleep(boost::posix_time::milliseconds(100)); +        std::this_thread::sleep_for(std::chrono::milliseconds(100));      }      //detect which channels to use diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp index dab42d46f..dfbaab54f 100644 --- a/host/examples/rx_samples_to_udp.cpp +++ b/host/examples/rx_samples_to_udp.cpp @@ -13,9 +13,10 @@  #include <uhd/exception.hpp>  #include <boost/program_options.hpp>  #include <boost/format.hpp> -#include <boost/thread.hpp>  #include <iostream>  #include <complex> +#include <chrono> +#include <thread>  namespace po = boost::program_options; @@ -96,7 +97,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      //set the antenna      if (vm.count("ant")) usrp->set_rx_antenna(ant); -    boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time +    std::this_thread::sleep_for(std::chrono::seconds(1)); //allow for some setup time      //Check Ref and LO Lock detect      std::vector<std::string> sensor_names; diff --git a/host/examples/sync_to_gps.cpp b/host/examples/sync_to_gps.cpp index f76e0d3ca..0b7f030bc 100644 --- a/host/examples/sync_to_gps.cpp +++ b/host/examples/sync_to_gps.cpp @@ -9,8 +9,9 @@  #include <uhd/usrp/multi_usrp.hpp>  #include <boost/format.hpp>  #include <boost/program_options.hpp> -#include <boost/thread.hpp>  #include <iostream> +#include <chrono> +#include <thread>  namespace po = boost::program_options; @@ -80,7 +81,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[])                      if (not ref_locked)                      {                          std::cout << "." << std::flush; -                        boost::this_thread::sleep(boost::posix_time::seconds(1)); +                        std::this_thread::sleep_for(std::chrono::seconds(1));                      }                  }                  if(ref_locked) @@ -117,7 +118,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[])              //The wait is 2 seconds because N-Series has a known issue where              //the time at the last PPS does not properly update at the PPS edge              //when the time is actually set. -            boost::this_thread::sleep(boost::posix_time::seconds(2)); +            std::this_thread::sleep_for(std::chrono::seconds(2));              //Check times              gps_time = uhd::time_spec_t(time_t(usrp->get_mboard_sensor("gps_time", mboard).to_int())); @@ -137,11 +138,11 @@ int UHD_SAFE_MAIN(int argc, char *argv[])              uhd::time_spec_t time_last_pps = usrp->get_time_last_pps();              while (time_last_pps == usrp->get_time_last_pps())              { -                boost::this_thread::sleep(boost::posix_time::milliseconds(1)); +                std::this_thread::sleep_for(std::chrono::milliseconds(1));              }              //Sleep a little to make sure all devices have seen a PPS edge -            boost::this_thread::sleep(boost::posix_time::milliseconds(200)); +            std::this_thread::sleep_for(std::chrono::milliseconds(200));              //Compare times across all mboards              bool all_matched = true; diff --git a/host/examples/test_clock_synch.cpp b/host/examples/test_clock_synch.cpp index 6f15887e8..38bc4980a 100644 --- a/host/examples/test_clock_synch.cpp +++ b/host/examples/test_clock_synch.cpp @@ -5,12 +5,6 @@  // SPDX-License-Identifier: GPL-3.0-or-later  // -#include <iostream> - -#include <boost/format.hpp> -#include <boost/program_options.hpp> -#include <boost/thread/thread.hpp> -  #include <uhd/device.hpp>  #include <uhd/exception.hpp>  #include <uhd/usrp_clock/multi_usrp_clock.hpp> @@ -19,6 +13,13 @@  #include <uhd/utils/safe_main.hpp>  #include <uhd/utils/thread.hpp> +#include <boost/format.hpp> +#include <boost/program_options.hpp> + +#include <iostream> +#include <chrono> +#include <thread> +  namespace po = boost::program_options;  using namespace uhd::usrp_clock; @@ -102,7 +103,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      for(size_t i = 0; i < num_tests; i++){          //Wait random time before querying          uint16_t wait_time = rand() % max_interval; -        boost::this_thread::sleep(boost::posix_time::milliseconds(wait_time)); +        std::this_thread::sleep_for(std::chrono::milliseconds(wait_time));          //Get all times before output          std::vector<time_t> usrp_times(usrp->get_num_mboards()); diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp index 7696e895c..a761f662d 100644 --- a/host/examples/test_dboard_coercion.cpp +++ b/host/examples/test_dboard_coercion.cpp @@ -10,12 +10,13 @@  #include <uhd/usrp/multi_usrp.hpp>  #include <boost/program_options.hpp>  #include <boost/format.hpp> -#include <boost/thread/thread.hpp>  #include <boost/math/special_functions/round.hpp>  #include <iostream>  #include <complex>  #include <utility>  #include <vector> +#include <chrono> +#include <thread>  static const double SAMP_RATE = 1e6; @@ -148,7 +149,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in          if(type == "TX") usrp->set_tx_freq(freq,chan);          else usrp->set_rx_freq(freq,chan); -        boost::this_thread::sleep(boost::posix_time::microseconds(long(1000))); +        std::this_thread::sleep_for(std::chrono::microseconds(long(1000)));          double actual_freq = (type == "TX") ? usrp->get_tx_freq(chan)                                              : usrp->get_rx_freq(chan); @@ -185,7 +186,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in                  if (is_locked) {                      break;                  } -                boost::this_thread::sleep(boost::posix_time::microseconds(1000)); +                std::this_thread::sleep_for(std::chrono::microseconds(1000));              }              if(is_locked){                  if(verbose) std::cout << boost::format("LO successfully locked at %s frequency %s.") @@ -206,7 +207,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in                  if(type == "TX") usrp->set_tx_gain(gain,chan);                  else usrp->set_rx_gain(gain,chan); -                boost::this_thread::sleep(boost::posix_time::microseconds(1000)); +                std::this_thread::sleep_for(std::chrono::microseconds(1000));                  double actual_gain = (type == "TX") ? usrp->get_tx_gain(chan)                                                      : usrp->get_rx_gain(chan); @@ -410,7 +411,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      //Setting clock source      usrp->set_clock_source(ref); -    boost::this_thread::sleep(boost::posix_time::seconds(1)); +    std::this_thread::sleep_for(std::chrono::seconds(1));      std::vector<std::string> sensor_names = usrp->get_mboard_sensor_names(0);      if ((ref == "mimo") and (std::find(sensor_names.begin(), sensor_names.end(), "mimo_locked") != sensor_names.end())) { diff --git a/host/examples/test_pps_input.cpp b/host/examples/test_pps_input.cpp index ec18b1cd8..b3c58da3b 100644 --- a/host/examples/test_pps_input.cpp +++ b/host/examples/test_pps_input.cpp @@ -10,9 +10,10 @@  #include <uhd/usrp/multi_usrp.hpp>  #include <boost/program_options.hpp>  #include <boost/format.hpp> -#include <boost/thread.hpp>  #include <iostream>  #include <complex> +#include <chrono> +#include <thread>  namespace po = boost::program_options; @@ -52,7 +53,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){      std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;      //sleep off if gpsdo detected and time next pps already set -    boost::this_thread::sleep(boost::posix_time::seconds(1)); +    std::this_thread::sleep_for(std::chrono::seconds(1));      //set time source if specified      if (not time_source.empty()) usrp->set_time_source(time_source); diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index 04cd8f3b4..e1b55eb1a 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.cpp @@ -14,12 +14,13 @@  #include <boost/program_options.hpp>  #include <boost/math/special_functions/round.hpp>  #include <boost/format.hpp> -#include <boost/thread.hpp>  #include <boost/algorithm/string.hpp>  #include <stdint.h>  #include <iostream>  #include <csignal>  #include <string> +#include <chrono> +#include <thread>  namespace po = boost::program_options; @@ -140,7 +141,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){          if (vm.count("ant")) usrp->set_tx_antenna(ant, channel_nums[ch]);      } -    boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time +    std::this_thread::sleep_for(std::chrono::seconds(1)); //allow for some setup time      //for the const wave, set the wave freq for small samples per period      if (wave_freq == 0 and wave_type == "CONST"){ @@ -188,14 +189,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){              usrp->set_time_now(uhd::time_spec_t(0.0), 0);              //sleep a bit while the slave locks its time to the master -            boost::this_thread::sleep(boost::posix_time::milliseconds(100)); +            std::this_thread::sleep_for(std::chrono::milliseconds(100));          }          else          {              if (pps == "internal" or pps == "external" or pps == "gpsdo")                  usrp->set_time_source(pps);              usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); -            boost::this_thread::sleep(boost::posix_time::seconds(1)); //wait for pps sync pulse +            std::this_thread::sleep_for(std::chrono::seconds(1)); //wait for pps sync pulse          }      }      else | 
