diff options
57 files changed, 226 insertions, 164 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 diff --git a/host/include/uhd/transport/nirio/nirio_fifo.h b/host/include/uhd/transport/nirio/nirio_fifo.h index 83401498b..c4de3c30b 100644 --- a/host/include/uhd/transport/nirio/nirio_fifo.h +++ b/host/include/uhd/transport/nirio/nirio_fifo.h @@ -9,16 +9,17 @@ #ifndef INCLUDED_UHD_TRANSPORT_NIRIO_NIRIO_FIFO_H #define INCLUDED_UHD_TRANSPORT_NIRIO_NIRIO_FIFO_H -#include <stdint.h> #include <uhd/transport/nirio/nirio_driver_iface.h> #include <uhd/transport/nirio/niriok_proxy.h> #include <uhd/transport/nirio/status.h> #include <boost/noncopyable.hpp> #include <boost/smart_ptr.hpp> -#include <string> #include <boost/thread/recursive_mutex.hpp> -#include <boost/thread/thread.hpp> #include <boost/atomic/atomic.hpp> +#include <string> +#include <chrono> +#include <thread> +#include <stdint.h> namespace uhd { namespace niusrprio { diff --git a/host/include/uhd/transport/nirio/nirio_fifo.ipp b/host/include/uhd/transport/nirio/nirio_fifo.ipp index 16099e939..048616b4c 100644 --- a/host/include/uhd/transport/nirio/nirio_fifo.ipp +++ b/host/include/uhd/transport/nirio/nirio_fifo.ipp @@ -431,7 +431,7 @@ nirio_status nirio_fifo<data_t>::_ensure_transfer_completed(uint32_t timeout_ms) (_expected_xfer_count > actual_xfer_count) && approx_us_elapsed++ < std::max<size_t>(MIN_TIMEOUT_IN_US, timeout_ms * 1000) ) { - boost::this_thread::sleep(boost::posix_time::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); nirio_status_chain(_get_transfer_count(actual_xfer_count), status); } diff --git a/host/lib/include/uhdlib/usrp/common/max287x.hpp b/host/lib/include/uhdlib/usrp/common/max287x.hpp index 762daf7b6..154a967b4 100644 --- a/host/lib/include/uhdlib/usrp/common/max287x.hpp +++ b/host/lib/include/uhdlib/usrp/common/max287x.hpp @@ -8,6 +8,8 @@ #ifndef MAX287X_HPP_INCLUDED #define MAX287X_HPP_INCLUDED +#include "max2870_regs.hpp" +#include "max2871_regs.hpp" #include <uhd/exception.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/ranges.hpp> @@ -16,12 +18,11 @@ #include <uhd/utils/safe_call.hpp> #include <boost/assign.hpp> #include <boost/function.hpp> -#include <boost/thread.hpp> #include <boost/math/special_functions/round.hpp> -#include <stdint.h> #include <vector> -#include "max2870_regs.hpp" -#include "max2871_regs.hpp" +#include <chrono> +#include <thread> +#include <stdint.h> /** * MAX287x interface @@ -915,7 +916,7 @@ void max287x<max287x_regs_t>::commit() if (_delay_after_write) { - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); _delay_after_write = false; } } diff --git a/host/lib/rfnoc/nocscript/gen_basic_funcs.py b/host/lib/rfnoc/nocscript/gen_basic_funcs.py index cd024af5c..fec6b04ad 100755 --- a/host/lib/rfnoc/nocscript/gen_basic_funcs.py +++ b/host/lib/rfnoc/nocscript/gen_basic_funcs.py @@ -26,7 +26,8 @@ from mako.template import Template # INCLUDE_LIST = """ #include <boost/math/special_functions/round.hpp> -#include <boost/thread/thread.hpp> +#include <chrono> +#include <thread> """ FUNCTION_LIST = """ CATEGORY: Math Functions @@ -251,7 +252,7 @@ CATEGORY: Execution Control BOOL SLEEP(DOUBLE) { int ms = ${args[0]} / 1000; - boost::this_thread::sleep(boost::posix_time::milliseconds(ms)); + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); ${RETURN}(true); } """ diff --git a/host/lib/rfnoc/source_block_ctrl_base.cpp b/host/lib/rfnoc/source_block_ctrl_base.cpp index d71905a1f..5ede899cb 100644 --- a/host/lib/rfnoc/source_block_ctrl_base.cpp +++ b/host/lib/rfnoc/source_block_ctrl_base.cpp @@ -9,6 +9,8 @@ #include <uhd/utils/log.hpp> #include <uhd/rfnoc/constants.hpp> #include <uhdlib/rfnoc/utils.hpp> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::rfnoc; @@ -103,7 +105,7 @@ void source_block_ctrl_base::configure_flow_control_out( //to flush is more than enough time. //TODO: Enhancement. We should get feedback from the FPGA about when the source_flow_control // module is done flushing. - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); //Resize the FC window. //Precondition: No data can be buffered upstream. diff --git a/host/lib/transport/muxed_zero_copy_if.cpp b/host/lib/transport/muxed_zero_copy_if.cpp index 9211ffeb2..2e7583276 100644 --- a/host/lib/transport/muxed_zero_copy_if.cpp +++ b/host/lib/transport/muxed_zero_copy_if.cpp @@ -14,6 +14,8 @@ #include <boost/thread.hpp> #include <boost/thread/locks.hpp> #include <map> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -210,7 +212,7 @@ private: if (not _process_next_buffer()) { //Be a good citizen and yield if no packet is processed static const size_t MIN_DUR = 1; - boost::this_thread::sleep_for(boost::chrono::nanoseconds(MIN_DUR)); + std::this_thread::sleep_for(std::chrono::nanoseconds(MIN_DUR)); //We call sleep(MIN_DUR) above instead of yield() to ensure that we //relinquish the current scheduler time slot. //yield() is a hint to the scheduler to end the time diff --git a/host/lib/transport/nirio/niusrprio_session.cpp b/host/lib/transport/nirio/niusrprio_session.cpp index 797855a11..bda0ec1c1 100644 --- a/host/lib/transport/nirio/niusrprio_session.cpp +++ b/host/lib/transport/nirio/niusrprio_session.cpp @@ -230,7 +230,7 @@ nirio_status niusrprio_session::_ensure_fpga_ready() boost::posix_time::ptime start_time = boost::posix_time::microsec_clock::local_time(); boost::posix_time::time_duration elapsed; do { - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //Avoid flooding the bus + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //Avoid flooding the bus elapsed = boost::posix_time::microsec_clock::local_time() - start_time; nirio_status_chain(_riok_proxy->peek(FPGA_STATUS_REG, reg_data), status); } while ( diff --git a/host/lib/transport/nirio_zero_copy.cpp b/host/lib/transport/nirio_zero_copy.cpp index 418e78d09..993a2c593 100644 --- a/host/lib/transport/nirio_zero_copy.cpp +++ b/host/lib/transport/nirio_zero_copy.cpp @@ -6,18 +6,19 @@ // #include <uhd/transport/nirio_zero_copy.hpp> -#include <stdio.h> #include <uhd/transport/nirio/nirio_fifo.h> - #include <uhd/utils/log.hpp> #include <uhdlib/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/thread/thread.hpp> //sleep #include <boost/interprocess/mapped_region.hpp> //get_page_size() #include <vector> #include <algorithm> // std::max +#include <chrono> +#include <thread> +#include <stdio.h> + //@TODO: Move the register defs required by the class to a common location #include "../usrp/x300/x300_regs.hpp" @@ -313,7 +314,7 @@ private: if (nirio_status_not_fatal(status) && (tx_busy || rx_busy)) { start_time = boost::posix_time::microsec_clock::local_time(); do { - boost::this_thread::sleep(boost::posix_time::microsec(50)); //Avoid flooding the bus + std::this_thread::sleep_for(std::chrono::microseconds(50)); //Avoid flooding the bus elapsed = boost::posix_time::microsec_clock::local_time() - start_time; nirio_status_chain(_proxy()->peek( PCIE_TX_DMA_REG(DMA_CTRL_STATUS_REG, _fifo_instance), reg_data), status); diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 9c18e2080..e824ef4e9 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -20,11 +20,11 @@ #include <uhd/transport/vrt_if_packet.hpp> #include <uhd/transport/zero_copy.hpp> #include <uhdlib/rfnoc/tx_stream_terminator.hpp> -#include <boost/thread/thread.hpp> -#include <boost/thread/thread_time.hpp> #include <boost/function.hpp> #include <iostream> #include <vector> +#include <chrono> +#include <thread> #ifdef UHD_TXRX_DEBUG_PRINTS // Included for debugging @@ -172,7 +172,7 @@ public: uhd::async_metadata_t &async_metadata, double timeout = 0.1 ){ if (_async_receiver) return _async_receiver(async_metadata, timeout); - boost::this_thread::sleep(boost::posix_time::microseconds(long(timeout*1e6))); + std::this_thread::sleep_for(std::chrono::microseconds(long(timeout*1e6))); return false; } diff --git a/host/lib/transport/tcp_zero_copy.cpp b/host/lib/transport/tcp_zero_copy.cpp index ddbc6b786..a52d089a8 100644 --- a/host/lib/transport/tcp_zero_copy.cpp +++ b/host/lib/transport/tcp_zero_copy.cpp @@ -8,13 +8,13 @@ #include "udp_common.hpp" #include <uhd/transport/tcp_zero_copy.hpp> #include <uhd/transport/buffer_pool.hpp> - #include <uhd/utils/log.hpp> #include <uhdlib/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> -#include <boost/thread/thread.hpp> //sleep #include <vector> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -85,7 +85,7 @@ public: if (ret == ssize_t(size())) break; if (ret == -1 and errno == ENOBUFS) { - boost::this_thread::sleep(boost::posix_time::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); continue; //try to send again } UHD_ASSERT_THROW(ret == ssize_t(size())); diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index dc87d7e4c..29dbd6c1e 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -14,8 +14,9 @@ #include <uhdlib/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> -#include <boost/thread/thread.hpp> //sleep #include <vector> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -116,7 +117,7 @@ public: if (ret == ssize_t(size())) break; if (ret == -1 and errno == ENOBUFS) { - boost::this_thread::sleep(boost::posix_time::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); continue; //try to send again } if (ret == -1) diff --git a/host/lib/transport/xport_benchmarker.cpp b/host/lib/transport/xport_benchmarker.cpp index c56b3a53e..0351d5106 100644 --- a/host/lib/transport/xport_benchmarker.cpp +++ b/host/lib/transport/xport_benchmarker.cpp @@ -6,6 +6,8 @@ // #include "xport_benchmarker.hpp" +#include <chrono> +#include <thread> namespace uhd { namespace transport { @@ -25,7 +27,7 @@ const device_addr_t& xport_benchmarker::benchmark_throughput_chdr _tx_thread.reset(new boost::thread(boost::bind(&xport_benchmarker::_stream_tx, this, tx_transport.get(), &pkt_info, big_endian))); _rx_thread.reset(new boost::thread(boost::bind(&xport_benchmarker::_stream_rx, this, rx_transport.get(), &pkt_info, big_endian))); - boost::this_thread::sleep(boost::posix_time::milliseconds(duration_ms)); + std::this_thread::sleep_for(std::chrono::milliseconds(duration_ms)); _tx_thread->interrupt(); _rx_thread->interrupt(); diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index 381bb2181..24da51e7f 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -6,8 +6,9 @@ // #include <uhd/types/serial.hpp> -#include <boost/thread.hpp> //for sleeping #include <boost/assign/list_of.hpp> +#include <chrono> +#include <thread> using namespace uhd; @@ -43,7 +44,7 @@ void i2c_iface::write_eeprom( //write a byte at a time, its easy that way byte_vector_t cmd = boost::assign::list_of(offset+i)(bytes[i]); this->write_i2c(addr, cmd); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //worst case write + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //worst case write } } @@ -104,7 +105,7 @@ struct eeprom16_impl : i2c_iface uint16_t offset_i = offset+i; byte_vector_t cmd = boost::assign::list_of(offset_i >> 8)(offset_i & 0xff)(bytes[i]); this->write_i2c(addr, cmd); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //worst case write + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //worst case write } } }; diff --git a/host/lib/usrp/b100/clock_ctrl.cpp b/host/lib/usrp/b100/clock_ctrl.cpp index e3ef7d6a5..c06b44c49 100644 --- a/host/lib/usrp/b100/clock_ctrl.cpp +++ b/host/lib/usrp/b100/clock_ctrl.cpp @@ -16,10 +16,11 @@ #include "b100_regs.hpp" //spi slave constants #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread/thread.hpp> #include <boost/math/common_factor_rt.hpp> //gcd #include <algorithm> #include <utility> +#include <chrono> +#include <thread> using namespace uhd; @@ -486,7 +487,7 @@ private: //wait for calibration done: static const uint8_t addr = 0x01F; for (size_t ms10 = 0; ms10 < 100; ms10++){ - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); uint32_t reg = read_reg(addr); _ad9522_regs.set_reg(addr, reg); if (_ad9522_regs.vco_calibration_finished) goto wait_for_ld; @@ -495,7 +496,7 @@ private: wait_for_ld: //wait for digital lock detect: for (size_t ms10 = 0; ms10 < 100; ms10++){ - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); uint32_t reg = read_reg(addr); _ad9522_regs.set_reg(addr, reg); if (_ad9522_regs.digital_lock_detect) return; diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 836a92ff7..432201429 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -13,7 +13,6 @@ #include <uhdlib/utils/ihex.hpp> #include <boost/functional/hash.hpp> -#include <boost/thread/thread.hpp> #include <boost/lexical_cast.hpp> #include <boost/format.hpp> #include <libusb.h> @@ -22,6 +21,8 @@ #include <vector> #include <cstring> #include <iomanip> +#include <chrono> +#include <thread> #include <stdint.h> //! libusb_error_name is only in newer API @@ -225,7 +226,7 @@ public: /* Success! Let the system settle. */ // TODO: Replace this with a polling loop in the FX3, or find out // what the actual, correct timeout value is. - boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } void reset_fx3(void) { @@ -431,7 +432,7 @@ public: return fx3_state; } - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); wait_count++; } while(fx3_state != FX3_STATE_FPGA_READY); @@ -456,7 +457,7 @@ public: return fx3_state; } - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); wait_count++; } while(fx3_state != FX3_STATE_CONFIGURING_FPGA); @@ -505,7 +506,7 @@ public: return fx3_state; } - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); wait_count++; } while(fx3_state != FX3_STATE_RUNNING); diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp index cbb720894..54f15d1a8 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp @@ -11,16 +11,16 @@ #include "ad9361_client.h" #include "ad9361_device.h" #define _USE_MATH_DEFINES -#include <cmath> #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> -#include <stdint.h> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/thread/thread.hpp> #include <boost/scoped_array.hpp> #include <boost/format.hpp> #include <boost/math/special_functions.hpp> +#include <chrono> +#include <thread> +#include <cmath> +#include <stdint.h> //////////////////////////////////////////////////////////// // the following macros evaluate to a compile time constant @@ -127,7 +127,7 @@ void ad9361_device_t::_program_fir_filter(direction_t direction, chain_t chain, /* Turn on the filter clock. */ _io_iface->poke8(base + 5, reg_numtaps | reg_chain | 0x02); - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); /* Zero the unused taps just in case they have stale data */ int addr; @@ -258,7 +258,7 @@ void ad9361_device_t::_calibrate_lock_bbpll() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(2)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } } @@ -283,7 +283,7 @@ void ad9361_device_t::_calibrate_synth_charge_pumps() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } _io_iface->poke8(0x23d, 0x00); @@ -296,7 +296,7 @@ void ad9361_device_t::_calibrate_synth_charge_pumps() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } _io_iface->poke8(0x27d, 0x00); } @@ -357,7 +357,7 @@ double ad9361_device_t::_calibrate_baseband_rx_analog_filter(double req_rfbw) break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } /* Disable RX1 & RX2 filter tuners. */ @@ -414,7 +414,7 @@ double ad9361_device_t::_calibrate_baseband_tx_analog_filter(double req_rfbw) } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } /* Disable the filter tuner. */ @@ -734,7 +734,7 @@ void ad9361_device_t::_calibrate_baseband_dc_offset() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } } @@ -767,7 +767,7 @@ void ad9361_device_t::_calibrate_rf_dc_offset() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); } _io_iface->poke8(0x18b, 0x8d); // Enable RF DC tracking @@ -818,7 +818,7 @@ void ad9361_device_t::_calibrate_rx_quadrature() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } _io_iface->poke8(0x057, 0x30); // Re-enable Tx mixers @@ -886,7 +886,7 @@ void ad9361_device_t::_tx_quadrature_cal_routine() { break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } @@ -1309,7 +1309,7 @@ double ad9361_device_t::_tune_helper(direction_t direction, const double value) _io_iface->poke8(0x005, _regs.vcodivs); /* Lock the PLL! */ - boost::this_thread::sleep(boost::posix_time::milliseconds(2)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); if ((_io_iface->peek8(0x247) & 0x02) == 0) { throw uhd::runtime_error("[ad9361_device_t] RX PLL NOT LOCKED"); } @@ -1350,7 +1350,7 @@ double ad9361_device_t::_tune_helper(direction_t direction, const double value) _io_iface->poke8(0x005, _regs.vcodivs); /* Lock the PLL! */ - boost::this_thread::sleep(boost::posix_time::milliseconds(2)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); if ((_io_iface->peek8(0x287) & 0x02) == 0) { throw uhd::runtime_error("[ad9361_device_t] TX PLL NOT LOCKED"); } @@ -1555,7 +1555,7 @@ void ad9361_device_t::initialize() /* Reset the device. */ _io_iface->poke8(0x000, 0x01); _io_iface->poke8(0x000, 0x00); - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); /* Check device ID to make sure iface works */ uint32_t device_id = (_io_iface->peek8(0x037) & 0x8); @@ -1590,7 +1590,7 @@ void ad9361_device_t::initialize() default: throw uhd::runtime_error("[ad9361_device_t] NOT IMPLEMENTED"); } - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); /* Tune the BBPLL, write TX and RX FIRS. */ _setup_rates(50e6); @@ -1698,7 +1698,7 @@ void ad9361_device_t::initialize() _io_iface->poke8(0x015, 0x04); // dual synth mode, synth en ctrl en _io_iface->poke8(0x014, 0x05); // use SPI for TXNRX ctrl, to ALERT, TX on _io_iface->poke8(0x013, 0x01); // enable ENSM - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); _calibrate_synth_charge_pumps(); @@ -1808,7 +1808,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate) case 0x05: /* We are in the ALERT state. */ _io_iface->poke8(0x014, 0x21); - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); _io_iface->poke8(0x014, 0x00); break; @@ -1838,7 +1838,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate) _io_iface->poke8(0x015, 0x04); //dual synth mode, synth en ctrl en _io_iface->poke8(0x014, 0x05); //use SPI for TXNRX ctrl, to ALERT, TX on _io_iface->poke8(0x013, 0x01); //enable ENSM - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); _calibrate_synth_charge_pumps(); @@ -2192,7 +2192,7 @@ double ad9361_device_t::_get_temperature(const double cal_offset, const double t boost::posix_time::time_duration elapsed; //wait for valid data (toggle of bit 1 in 0x00C) while(((_io_iface->peek8(0x00C) >> 1) & 0x01) == 0) { - boost::this_thread::sleep(boost::posix_time::microseconds(100)); + std::this_thread::sleep_for(std::chrono::microseconds(100)); elapsed = boost::posix_time::microsec_clock::local_time() - start_time; if(elapsed.total_milliseconds() > (timeout*1000)) { diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp index 6e1b374ca..77501d981 100644 --- a/host/lib/usrp/common/fx2_ctrl.cpp +++ b/host/lib/usrp/common/fx2_ctrl.cpp @@ -10,13 +10,14 @@ #include <uhd/exception.hpp> #include <uhd/transport/usb_control.hpp> #include <boost/functional/hash.hpp> -#include <boost/thread/thread.hpp> #include <stdint.h> #include <fstream> #include <sstream> #include <string> #include <vector> #include <cstring> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -137,7 +138,7 @@ public: usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_y, 1); usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_n, 1); //wait for things to settle - boost::this_thread::sleep(boost::posix_time::milliseconds(2000)); + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); } void usrp_load_firmware(std::string filestring, bool force) @@ -194,7 +195,7 @@ public: file.close(); //wait for things to settle - boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Firmware loaded"; return; } @@ -302,7 +303,7 @@ public: } addr += pagesize; len -= pagesize; - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); } file.close(); if (load_img_msg) UHD_LOGGER_INFO("FX2") << "EEPROM image loaded"; diff --git a/host/lib/usrp/cores/dma_fifo_core_3000.cpp b/host/lib/usrp/cores/dma_fifo_core_3000.cpp index 618f81f64..445706574 100644 --- a/host/lib/usrp/cores/dma_fifo_core_3000.cpp +++ b/host/lib/usrp/cores/dma_fifo_core_3000.cpp @@ -10,7 +10,8 @@ #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/dma_fifo_core_3000.hpp> #include <boost/format.hpp> -#include <boost/thread/thread.hpp> //sleep +#include <chrono> +#include <thread> using namespace uhd; @@ -315,7 +316,7 @@ public: _bist_ctrl_reg.write(bist_ctrl_reg_t::GO, 1); if (!finite) { - boost::this_thread::sleep(boost::posix_time::milliseconds(timeout_ms)); + std::this_thread::sleep_for(std::chrono::milliseconds(timeout_ms)); } _wait_for_bist_done(timeout_ms, !finite); @@ -345,7 +346,7 @@ private: boost::posix_time::time_duration elapsed; while (_fifo_readback.is_fifo_busy()) { - boost::this_thread::sleep(boost::posix_time::microsec(1000)); + std::this_thread::sleep_for(std::chrono::microseconds(1000)); elapsed = boost::posix_time::microsec_clock::local_time() - start_time; if (elapsed.total_milliseconds() > 100) break; } @@ -361,7 +362,7 @@ private: _bist_ctrl_reg.write(bist_ctrl_reg_t::GO, 0); force_stop = false; } - boost::this_thread::sleep(boost::posix_time::microsec(1000)); + std::this_thread::sleep_for(std::chrono::microseconds(1000)); elapsed = boost::posix_time::microsec_clock::local_time() - start_time; if (elapsed.total_milliseconds() > timeout_ms) break; } diff --git a/host/lib/usrp/cores/i2c_core_100_wb32.cpp b/host/lib/usrp/cores/i2c_core_100_wb32.cpp index c6a0e8d84..ec47aa8f0 100644 --- a/host/lib/usrp/cores/i2c_core_100_wb32.cpp +++ b/host/lib/usrp/cores/i2c_core_100_wb32.cpp @@ -8,7 +8,8 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/i2c_core_100_wb32.hpp> -#include <boost/thread/thread.hpp> //sleep +#include <chrono> +#include <thread> #define REG_I2C_PRESCALER_LO _base + 0 #define REG_I2C_PRESCALER_HI _base + 4 @@ -126,7 +127,7 @@ private: for (size_t i = 0; i < 10; i++) { if ((_iface->peek32(REG_I2C_CMD_STATUS) & I2C_ST_TIP) == 0) return; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } UHD_LOGGER_ERROR("CORES") << "i2c_core_100_wb32: i2c_wait timeout" ; } diff --git a/host/lib/usrp/cores/i2c_core_200.cpp b/host/lib/usrp/cores/i2c_core_200.cpp index c0a6cb949..4278bf611 100644 --- a/host/lib/usrp/cores/i2c_core_200.cpp +++ b/host/lib/usrp/cores/i2c_core_200.cpp @@ -8,8 +8,9 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/i2c_core_200.hpp> -#include <boost/thread/thread.hpp> //sleep #include <boost/thread/mutex.hpp> +#include <chrono> +#include <thread> #define REG_I2C_WR_PRESCALER_LO (1 << 3) | 0 #define REG_I2C_WR_PRESCALER_HI (1 << 3) | 1 @@ -118,7 +119,7 @@ private: void i2c_wait(void) { for (size_t i = 0; i < 100; i++){ if ((this->peek(REG_I2C_RD_ST) & I2C_ST_TIP) == 0) return; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } UHD_LOGGER_ERROR("CORES") << "i2c_core_200: i2c_wait timeout" ; } diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 730985fdd..a87b92a50 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -13,11 +13,12 @@ #include <uhdlib/usrp/cores/rx_dsp_core_200.hpp> #include <uhdlib/usrp/cores/dsp_core_utils.hpp> #include <boost/assign/list_of.hpp> -#include <boost/thread/thread.hpp> //thread sleep #include <boost/math/special_functions/round.hpp> #include <boost/numeric/conversion/bounds.hpp> #include <algorithm> #include <cmath> +#include <chrono> +#include <thread> #define REG_DSP_RX_FREQ _dsp_base + 0 #define REG_DSP_RX_SCALE_IQ _dsp_base + 4 @@ -69,7 +70,7 @@ public: stream_cmd_t stream_cmd(stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); stream_cmd.num_samps = 1; issue_stream_command(stream_cmd); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //lets lingering pkt propagate + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //lets lingering pkt propagate } this->clear(); diff --git a/host/lib/usrp/cores/time_core_3000.cpp b/host/lib/usrp/cores/time_core_3000.cpp index edec2880b..3fb6c3d57 100644 --- a/host/lib/usrp/cores/time_core_3000.cpp +++ b/host/lib/usrp/cores/time_core_3000.cpp @@ -8,7 +8,8 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/time_core_3000.hpp> -#include <boost/thread/thread.hpp> +#include <chrono> +#include <thread> #define REG_TIME_HI _base + 0 #define REG_TIME_LO _base + 4 @@ -55,7 +56,7 @@ struct time_core_3000_impl : time_core_3000 const size_t sleep_millis = 100; UHD_LOGGER_DEBUG("CORES") << "Performing timer loopback test... "; const time_spec_t time0 = this->get_time_now(); - boost::this_thread::sleep(boost::posix_time::milliseconds(sleep_millis)); + std::this_thread::sleep_for(std::chrono::milliseconds(sleep_millis)); const time_spec_t time1 = this->get_time_now(); const double approx_secs = (time1 - time0).get_real_secs(); const bool test_fail = (approx_secs > 0.15) or (approx_secs < 0.05); diff --git a/host/lib/usrp/cores/tx_dsp_core_200.cpp b/host/lib/usrp/cores/tx_dsp_core_200.cpp index efd64f7e5..6418d7049 100644 --- a/host/lib/usrp/cores/tx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_200.cpp @@ -13,9 +13,10 @@ #include <uhd/utils/log.hpp> #include <boost/assign/list_of.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/thread/thread.hpp> //sleep #include <algorithm> #include <cmath> +#include <chrono> +#include <thread> #define REG_DSP_TX_FREQ _dsp_base + 0 #define REG_DSP_TX_SCALE_IQ _dsp_base + 4 @@ -68,7 +69,7 @@ public: void clear(void){ _iface->poke32(REG_TX_CTRL_CLEAR, 1); //reset and flush technique - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); _iface->poke32(REG_TX_CTRL_CLEAR, 0); _iface->poke32(REG_TX_CTRL_REPORT_SID, _sid); } diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 8266b6d9e..587158470 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -22,10 +22,11 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/math/special_functions/round.hpp> #include <utility> #include <cmath> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -396,7 +397,7 @@ double dbsrx::set_lo_freq(double target_freq){ read_reg(0x0, 0x0); //allow for setup time before checking condition again - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } UHD_LOGGER_TRACE("DBSRX") << boost::format( diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 8bf2308d7..5f43c75e6 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -53,11 +53,12 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/array.hpp> #include <boost/math/special_functions/round.hpp> #include <utility> #include <cmath> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -1695,7 +1696,7 @@ void tvrx2::wait_irq(void){ while (not irq and timeout > 0) { //irq = (this->get_iface()->read_gpio(dboard_iface::UNIT_RX) & tvrx2_sd_name_to_irq_io[get_subdev_name()]); irq = get_irq(); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); timeout -= 1; } diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 0e85cf188..6c6862fb7 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -23,10 +23,11 @@ #include <boost/assign/list_of.hpp> #include <boost/shared_ptr.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/thread.hpp> #include <boost/algorithm/string.hpp> #include <boost/thread/mutex.hpp> #include <map> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -384,7 +385,7 @@ public: _iface->set_pin_ctrl(dboard_iface::UNIT_RX, _rx_gpio_reg.atr_mask); // bring CPLD out of reset - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); // hold CPLD reset for minimum of 20 ms + std::this_thread::sleep_for(std::chrono::milliseconds(20)); // hold CPLD reset for minimum of 20 ms set_gpio_field(CPLD_RST_N, 1); write_gpio(); diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index 73e778b1b..9e1c9f2b0 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -50,9 +50,10 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/math/special_functions/round.hpp> #include <utility> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -307,11 +308,11 @@ void xcvr2450::spi_reset(void){ //spi reset mode: global enable = off, tx and rx enable = on this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, gpio_atr::ATR_REG_IDLE, TX_ENB_TXIO); this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, gpio_atr::ATR_REG_IDLE, RX_ENB_RXIO | POWER_DOWN_RXIO); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //take it back out of spi reset mode and wait a bit this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, gpio_atr::ATR_REG_IDLE, RX_DIS_RXIO | POWER_UP_RXIO); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } /*********************************************************************** @@ -348,7 +349,7 @@ double xcvr2450::set_lo_freq(double target_freq){ double actual = 0.0; for (double offset = 0.0; offset <= 3e6; offset+=1e6){ actual = this->set_lo_freq_core(target_freq + offset); - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); if (this->get_locked().to_bool()) break; } return actual; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 3e8473087..d8233e1f7 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -10,7 +10,8 @@ #include <uhdlib/usrp/common/adf535x.hpp> #include <uhd/utils/math.hpp> #include <uhd/utils/safe_call.hpp> -#include <boost/thread/thread.hpp> +#include <chrono> +#include <thread> using namespace uhd; using namespace usrp; @@ -40,7 +41,7 @@ public: _gpio_iface->set_field(twinrx_gpio::FIELD_SWPS_EN, 1); size_t timeout_ms = 100; while (_gpio_iface->get_field(twinrx_gpio::FIELD_SWPS_PWR_GOOD) == 0) { - boost::this_thread::sleep(boost::posix_time::microsec(1000)); + std::this_thread::sleep_for(std::chrono::microseconds(1000)); if (--timeout_ms == 0) { throw uhd::runtime_error("power supply failure"); } diff --git a/host/lib/usrp/dboard_iface.cpp b/host/lib/usrp/dboard_iface.cpp index 55b3c19ba..3bda643fe 100644 --- a/host/lib/usrp/dboard_iface.cpp +++ b/host/lib/usrp/dboard_iface.cpp @@ -6,6 +6,8 @@ // #include <uhd/usrp/dboard_iface.hpp> +#include <chrono> +#include <thread> using namespace uhd::usrp; @@ -14,8 +16,8 @@ void dboard_iface::sleep(const boost::chrono::nanoseconds& time) //nanosleep is not really accurate in userland and it is also not very //cross-platform. So just sleep for the minimum amount of time in us. if (time < boost::chrono::microseconds(1)) { - boost::this_thread::sleep_for(boost::chrono::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); } else { - boost::this_thread::sleep_for(time); + std::this_thread::sleep_for(std::chrono::microseconds(time.count())); } } diff --git a/host/lib/usrp/e300/e300_fifo_config.cpp b/host/lib/usrp/e300/e300_fifo_config.cpp index 044ce01ee..2c0027ae0 100644 --- a/host/lib/usrp/e300/e300_fifo_config.cpp +++ b/host/lib/usrp/e300/e300_fifo_config.cpp @@ -11,6 +11,8 @@ #include <uhd/config.hpp> #include <stdint.h> #include <atomic> +#include <chrono> +#include <thread> // constants coded into the fpga parameters static const size_t ZF_CONFIG_BASE = 0x40000000; @@ -256,7 +258,7 @@ public: break; } _waiter->wait(timeout); - //boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + //std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return typename T::sptr(); diff --git a/host/lib/usrp/e300/e300_i2c.cpp b/host/lib/usrp/e300/e300_i2c.cpp index c3db4f67a..24fd429b5 100644 --- a/host/lib/usrp/e300/e300_i2c.cpp +++ b/host/lib/usrp/e300/e300_i2c.cpp @@ -5,13 +5,14 @@ // SPDX-License-Identifier: GPL-3.0-or-later // +#include "e300_i2c.hpp" #include <uhd/exception.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/transport/udp_simple.hpp> - -#include "e300_i2c.hpp" #include <cstring> +#include <chrono> +#include <thread> namespace uhd { namespace usrp { namespace e300 { @@ -281,7 +282,7 @@ public: throw std::runtime_error("ioctl failed"); } // this is ugly - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } uint8_t get_i2c_reg8( @@ -339,7 +340,7 @@ public: throw std::runtime_error("ioctl failed"); } // this is ugly - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 324b25407..9aa872ff3 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -32,9 +32,10 @@ #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <boost/assign/list_of.hpp> -#include <boost/thread/thread.hpp> //sleep #include <boost/asio.hpp> #include <fstream> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -395,7 +396,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) ad9361_params::sptr client_settings = boost::make_shared<e300_ad9361_client_t>(); _codec_ctrl = ad9361_ctrl::make_spi(client_settings, spi::make(E300_SPIDEV_DEVICE), 1); // This is horrible ... why do I have to sleep here? - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); _eeprom_manager = boost::make_shared<e300_eeprom_manager>(i2c::make_i2cdev(E300_I2CDEV_DEVICE)); _sensor_manager = e300_sensor_manager::make_local(_global_regs); } @@ -415,7 +416,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) if (_gps) { for (size_t i = 0; i < _GPS_TIMEOUT; i++) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(std::chrono::seconds(1)); if (!_gps->gps_detected()) std::cout << "." << std::flush; else { @@ -1141,7 +1142,7 @@ void e300_impl::_reset_codec_mmcm(void) { _misc.codec_arst = 1; _update_gpio_state(); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); _misc.codec_arst = 0; _update_gpio_state(); } diff --git a/host/lib/usrp/e300/e300_network.cpp b/host/lib/usrp/e300/e300_network.cpp index d7473d2ee..d9a104dda 100644 --- a/host/lib/usrp/e300/e300_network.cpp +++ b/host/lib/usrp/e300/e300_network.cpp @@ -26,11 +26,12 @@ #include <uhdlib/usrp/common/ad9361_ctrl.hpp> #include <boost/asio.hpp> -#include <boost/thread.hpp> #include <boost/filesystem.hpp> #include <boost/make_shared.hpp> #include <fstream> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -630,7 +631,7 @@ network_server_impl::network_server_impl(const uhd::device_addr_t &device_addr) ad9361_params::sptr client_settings = boost::make_shared<e300_ad9361_client_t>(); _codec_ctrl = ad9361_ctrl::make_spi(client_settings, spi::make(E300_SPIDEV_DEVICE), 1); // This is horrible ... why do I have to sleep here? - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); _sensor_manager = e300_sensor_manager::make_local(_global_regs); } diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index a50261851..f030108cc 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -28,7 +28,6 @@ using namespace uhd; using namespace boost::posix_time; using namespace boost::algorithm; -using namespace boost::this_thread; namespace { constexpr int GPS_COMM_TIMEOUT_MS = 1300; diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index f9509b7f3..6c758e07e 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -20,12 +20,13 @@ #include <uhdlib/usrp/gpio_defs.hpp> #include <uhdlib/rfnoc/legacy_compat.hpp> #include <boost/assign/list_of.hpp> -#include <boost/thread.hpp> #include <boost/format.hpp> #include <boost/algorithm/string.hpp> #include <algorithm> #include <cmath> #include <bitset> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -579,12 +580,12 @@ public: "See the application notes for your device.\n" ); } - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } UHD_LOGGER_INFO("MULTI_USRP") << " 2) set times next pps (synchronously)"; set_time_next_pps(time_spec, ALL_MBOARDS); - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(std::chrono::seconds(1)); //verify that the time registers are read to be within a few RTT for (size_t m = 1; m < get_num_mboards(); m++){ diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp index c4e3af0b2..0595ee29d 100644 --- a/host/lib/usrp/n230/n230_impl.cpp +++ b/host/lib/usrp/n230/n230_impl.cpp @@ -37,6 +37,9 @@ #include <boost/asio.hpp> //used for htonl and ntohl #include <boost/make_shared.hpp> +#include <chrono> +#include <thread> + namespace uhd { namespace usrp { namespace n230 { using namespace uhd::transport; @@ -131,7 +134,7 @@ uhd::device_addrs_t n230_impl::n230_find(const uhd::device_addr_t &multi_dev_hin fw_ctrl = n230_fw_ctrl_iface::make(ctrl_xport, N230_FW_PRODUCT_ID, false /*verbose*/); break; } catch (uhd::io_error& ex) { - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); first_conn_retries--; } } diff --git a/host/lib/usrp/n230/n230_resource_manager.cpp b/host/lib/usrp/n230/n230_resource_manager.cpp index e9f8b5c7d..7a68816a3 100644 --- a/host/lib/usrp/n230/n230_resource_manager.cpp +++ b/host/lib/usrp/n230/n230_resource_manager.cpp @@ -15,11 +15,12 @@ #include <uhd/utils/platform.hpp> #include <uhd/utils/paths.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/functional/hash.hpp> #include <boost/make_shared.hpp> #include "n230_fw_defs.h" #include "n230_fw_host_iface.h" +#include <chrono> +#include <thread> #define IF_DATA_I_MASK 0xFFF00000 #define IF_DATA_Q_MASK 0x0000FFF0 @@ -206,7 +207,7 @@ n230_resource_manager::n230_resource_manager( _gps_uart = n230_uart::make(gps_uart_xport, uhd::htonx(gps_uart_sid.get())); _gps_uart->set_baud_divider(fpga::BUS_CLK_RATE/fpga::GPSDO_UART_BAUDRATE); _gps_uart->write_uart("\n"); //cause the baud and response to be setup - boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for a little propagation + std::this_thread::sleep_for(std::chrono::seconds(1)); //allow for a little propagation _gps_ctrl = gps_ctrl::make(_gps_uart); } catch(std::exception &e) { UHD_LOGGER_ERROR("N230") << "An error occurred making GPSDO control: " << e.what() ; @@ -283,7 +284,7 @@ void n230_resource_manager::_claimer_loop() _fw_ctrl->poke32(N230_FW_HOST_SHMEM_OFFSET(claim_time), time(NULL)); _fw_ctrl->poke32(N230_FW_HOST_SHMEM_OFFSET(claim_src), get_process_hash()); } - boost::this_thread::sleep(boost::posix_time::milliseconds(N230_CLAIMER_TIMEOUT_IN_MS / 2)); + std::this_thread::sleep_for(std::chrono::milliseconds(N230_CLAIMER_TIMEOUT_IN_MS / 2)); } void n230_resource_manager::_initialize_radio(size_t instance) @@ -444,7 +445,7 @@ void n230_resource_manager::_reset_codec_digital_interface() _core_ctrl->poke32(fpga::sr_addr(fpga::SR_CORE_CLK_DELAY), fpga::CODEC_CLK_DELAY); _core_radio_ctrl_reg.write(fpga::core_radio_ctrl_reg_t::CODEC_ARST, 1); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); _core_radio_ctrl_reg.write(fpga::core_radio_ctrl_reg_t::CODEC_ARST, 0); } @@ -470,7 +471,7 @@ bool n230_resource_manager::_radio_data_loopback_self_test(wb_iface::sptr iface) const uint32_t word32 = uint32_t(hash) & (IF_DATA_I_MASK | IF_DATA_Q_MASK); iface->poke32(fpga::sr_addr(fpga::SR_RADIO_CODEC_IDLE), word32); iface->peek64(fpga::rb_addr(fpga::RB_RADIO_CODEC_DATA)); //block until request completes - boost::this_thread::sleep(boost::posix_time::microseconds(100)); //wait for loopback to propagate through codec + std::this_thread::sleep_for(std::chrono::microseconds(100)); //wait for loopback to propagate through codec const uint64_t rb_word64 = iface->peek64(fpga::rb_addr(fpga::RB_RADIO_CODEC_DATA)); const uint32_t rb_tx = uint32_t(rb_word64 >> 32); const uint32_t rb_rx = uint32_t(rb_word64 & 0xffffffff); diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 0e79a5985..3ccfa11c9 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -23,6 +23,8 @@ #include <boost/format.hpp> #include <boost/make_shared.hpp> #include <atomic> +#include <chrono> +#include <thread> #define bmFR_RX_FORMAT_SHIFT_SHIFT 0 #define bmFR_RX_FORMAT_WIDTH_SHIFT 4 @@ -307,7 +309,7 @@ void usrp1_impl::vandal_conquest_loop(std::atomic<bool> &exit_loop){ UHD_LOG_FASTPATH("O") } - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); }} catch(const std::exception &e){ UHD_LOGGER_ERROR("USRP1") << "The vandal caught an unexpected exception " << e.what() ; diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 2b8c7a5d1..7042f0391 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -26,6 +26,8 @@ #include <boost/thread/mutex.hpp> #include <boost/make_shared.hpp> #include <iostream> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -384,7 +386,7 @@ void usrp2_impl::program_stream_dest( std::memcpy(send_buff->cast<void *>(), &stream_ctrl, sizeof(stream_ctrl)); send_buff->commit(sizeof(stream_ctrl)); send_buff.reset(); - boost::this_thread::sleep(boost::posix_time::milliseconds(300)); + std::this_thread::sleep_for(std::chrono::milliseconds(300)); managed_recv_buffer::sptr recv_buff = xport->get_recv_buff(0.0); if (recv_buff and recv_buff->size() >= sizeof(uint32_t)){ const uint32_t result = uhd::ntohx(recv_buff->cast<const uint32_t *>()[0]); diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index a3d1bc390..c8283c500 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -16,7 +16,6 @@ #include <uhd/utils/paths.hpp> #include <uhd/utils/safe_call.hpp> #include <uhd/types/dict.hpp> -#include <boost/thread.hpp> #include <boost/asio.hpp> //used for htonl and ntohl #include <boost/assign/list_of.hpp> #include <boost/format.hpp> @@ -26,6 +25,8 @@ #include <boost/filesystem.hpp> #include <algorithm> #include <iostream> +#include <chrono> +#include <thread> #include <uhd/utils/platform.hpp> using namespace uhd; @@ -118,7 +119,7 @@ public: //re-lock in task this->pokefw(U2_FW_REG_LOCK_TIME, this->get_curr_time()); //sleep for a bit - boost::this_thread::sleep(boost::posix_time::milliseconds(1500)); + std::this_thread::sleep_for(std::chrono::milliseconds(1500)); } uint32_t get_curr_time(void){ diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 6208de231..cf1d9d7c2 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -928,7 +928,7 @@ void x300_radio_ctrl_impl::synchronize_dacs(const std::vector<x300_radio_ctrl_im } //Wait and check status - boost::this_thread::sleep(boost::posix_time::microseconds(t_sync_us)); + std::this_thread::sleep_for(std::chrono::microseconds(t_sync_us)); for (size_t i = 0; i < radios.size(); i++) { radios[i]->_dac->verify_sync(); } diff --git a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp index 594d10df6..e030e6106 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp @@ -20,7 +20,6 @@ #include <boost/filesystem.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <algorithm> #include <iterator> @@ -29,6 +28,8 @@ #include <fstream> #include <iostream> #include <string> +#include <chrono> +#include <thread> #include <stdint.h> namespace fs = boost::filesystem; @@ -194,7 +195,7 @@ static void octoclock_reset_into_bootloader(octoclock_session_t &session){ if(UHD_OCTOCLOCK_PACKET_MATCHES(RESET_ACK, pkt_out, pkt_in, len)){ // Make sure this device is now in its bootloader - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); uhd::device_addrs_t octoclocks = uhd::device::find( uhd::device_addr_t(str(boost::format("addr=%s") % session.dev_addr["addr"] diff --git a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp index 490814c40..74d324645 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp @@ -7,11 +7,13 @@ #include <iostream> #include <string> +#include <chrono> +#include <thread> #include <string.h> +#include <stdint.h> #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> -#include <stdint.h> #include <boost/format.hpp> #include <boost/thread/thread.hpp> @@ -95,7 +97,7 @@ namespace uhd{ { break; } - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return result; diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp index f261cc61c..75bb1a5bb 100644 --- a/host/utils/b2xx_fx3_utils.cpp +++ b/host/utils/b2xx_fx3_utils.cpp @@ -15,13 +15,14 @@ #include <string> #include <cmath> #include <cstring> +#include <chrono> +#include <thread> #include <stdint.h> #include <boost/filesystem.hpp> #include <boost/lexical_cast.hpp> #include <boost/format.hpp> #include <boost/program_options.hpp> -#include <boost/thread/thread.hpp> #include <boost/functional/hash.hpp> #include <b200_iface.hpp> @@ -395,7 +396,7 @@ int32_t main(int32_t argc, char *argv[]) { // re-open device b200.reset(); handle.reset(); - boost::this_thread::sleep(boost::posix_time::seconds(2)); // wait 2 seconds for FX3 to reset + std::this_thread::sleep_for(std::chrono::seconds(2)); // wait 2 seconds for FX3 to reset handle = open_device(vid, pid); if (!handle) return -1; diff --git a/host/utils/query_gpsdo_sensors.cpp b/host/utils/query_gpsdo_sensors.cpp index 525c20482..d909f83a9 100644 --- a/host/utils/query_gpsdo_sensors.cpp +++ b/host/utils/query_gpsdo_sensors.cpp @@ -15,13 +15,13 @@ #include <boost/format.hpp> #include <iostream> #include <complex> -#include <boost/thread.hpp> #include <string> #include <cmath> #include <ctime> #include <cstdlib> #include <chrono> #include <thread> + namespace po = boost::program_options; namespace fs = boost::filesystem; @@ -130,7 +130,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ if(std::find(sensor_names.begin(), sensor_names.end(), "ref_locked") != sensor_names.end()) { uhd::sensor_value_t ref_locked = usrp->get_mboard_sensor("ref_locked",0); for (size_t i = 0; not ref_locked.to_bool() and i < 100; i++) { - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); ref_locked = usrp->get_mboard_sensor("ref_locked",0); } if(not ref_locked.to_bool()) { @@ -210,7 +210,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //second and set the device time at the next PPS edge usrp->set_time_next_pps(uhd::time_spec_t(gps_time.to_int() + 1.0)); //allow some time to make sure the PPS has come… - boost::this_thread::sleep(boost::posix_time::milliseconds(1100)); + std::this_thread::sleep_for(std::chrono::milliseconds(1100)); //…then ask gps_seconds = usrp->get_mboard_sensor("gps_time").to_int(); pps_seconds = usrp->get_time_last_pps().to_ticks(1.0); diff --git a/host/utils/uhd_cal_rx_iq_balance.cpp b/host/utils/uhd_cal_rx_iq_balance.cpp index 254ea9de7..470a66f9c 100644 --- a/host/utils/uhd_cal_rx_iq_balance.cpp +++ b/host/utils/uhd_cal_rx_iq_balance.cpp @@ -20,6 +20,8 @@ #include <cmath> #include <ctime> #include <cstdlib> +#include <chrono> +#include <thread> namespace po = boost::program_options; @@ -73,7 +75,7 @@ static double tune_rx_and_tx(uhd::usrp::multi_usrp::sptr usrp, const double rx_l usrp->set_tx_freq(tx_tune_req); //wait for the LOs to become locked - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); boost::system_time start = boost::get_system_time(); while (not usrp->get_tx_sensor("lo_locked").to_bool() or not usrp->get_rx_sensor("lo_locked").to_bool()) { @@ -278,7 +280,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) //stop the transmitter threads.interrupt_all(); - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); //wait for threads to finish + std::this_thread::sleep_for(std::chrono::milliseconds(500)); //wait for threads to finish threads.join_all(); store_results(results, "RX", "rx", "iq", serial); diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp index 4adea9c2a..ecd676e07 100644 --- a/host/utils/uhd_cal_tx_dc_offset.cpp +++ b/host/utils/uhd_cal_tx_dc_offset.cpp @@ -18,6 +18,8 @@ #include <iostream> #include <complex> #include <ctime> +#include <chrono> +#include <thread> namespace po = boost::program_options; @@ -80,7 +82,7 @@ static double tune_rx_and_tx(uhd::usrp::multi_usrp::sptr usrp, const double tx_l usrp->set_rx_freq(rx_tune_req); //wait for the LOs to become locked - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); boost::system_time start = boost::get_system_time(); while (not usrp->get_tx_sensor("lo_locked").to_bool() or not usrp->get_rx_sensor("lo_locked").to_bool()) { @@ -282,7 +284,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) //stop the transmitter threads.interrupt_all(); - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); //wait for threads to finish + std::this_thread::sleep_for(std::chrono::milliseconds(500)); //wait for threads to finish threads.join_all(); store_results(results, "TX", "tx", "dc", serial); diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp index 3cc7b80c7..da8807479 100644 --- a/host/utils/uhd_cal_tx_iq_balance.cpp +++ b/host/utils/uhd_cal_tx_iq_balance.cpp @@ -15,6 +15,8 @@ #include <complex> #include <ctime> #include <cstdlib> +#include <chrono> +#include <thread> namespace po = boost::program_options; @@ -77,7 +79,7 @@ static double tune_rx_and_tx(uhd::usrp::multi_usrp::sptr usrp, const double tx_l usrp->set_rx_freq(rx_tune_req); //wait for the LOs to become locked - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); boost::system_time start = boost::get_system_time(); while (not usrp->get_tx_sensor("lo_locked").to_bool() or not usrp->get_rx_sensor("lo_locked").to_bool()) { @@ -281,7 +283,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) //stop the transmitter threads.interrupt_all(); - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); //wait for threads to finish + std::this_thread::sleep_for(std::chrono::milliseconds(500)); //wait for threads to finish threads.join_all(); store_results(results, "TX", "tx", "iq", serial); |