From 0303f1ed558b21e40f80c388b096432b4bf6e883 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 26 Apr 2018 09:30:48 -0700 Subject: lib: Purge all references to boost::this_thread::sleep() Replace with std::this_thread::sleep_for(). --- host/lib/transport/muxed_zero_copy_if.cpp | 4 +++- host/lib/transport/nirio/niusrprio_session.cpp | 2 +- host/lib/transport/nirio_zero_copy.cpp | 9 +++++---- host/lib/transport/super_send_packet_handler.hpp | 6 +++--- host/lib/transport/tcp_zero_copy.cpp | 6 +++--- host/lib/transport/udp_zero_copy.cpp | 5 +++-- host/lib/transport/xport_benchmarker.cpp | 4 +++- 7 files changed, 21 insertions(+), 15 deletions(-) (limited to 'host/lib/transport') 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 #include #include +#include +#include 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 -#include #include - #include #include #include #include #include -#include //sleep #include //get_page_size() #include #include // std::max +#include +#include +#include + //@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 #include #include -#include -#include #include #include #include +#include +#include #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 #include - #include #include #include #include -#include //sleep #include +#include +#include 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 #include #include -#include //sleep #include +#include +#include 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 +#include 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(); -- cgit v1.2.3