diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-04-26 09:30:48 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-04-30 17:10:26 -0700 |
commit | 0303f1ed558b21e40f80c388b096432b4bf6e883 (patch) | |
tree | 05afcc4d2401bb86f9e38e3b04ec5b07e9268302 /host/lib/transport | |
parent | fc67052345373c6d5c1b62064a9f9ef6f888e3ff (diff) | |
download | uhd-0303f1ed558b21e40f80c388b096432b4bf6e883.tar.gz uhd-0303f1ed558b21e40f80c388b096432b4bf6e883.tar.bz2 uhd-0303f1ed558b21e40f80c388b096432b4bf6e883.zip |
lib: Purge all references to boost::this_thread::sleep()
Replace with std::this_thread::sleep_for().
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/muxed_zero_copy_if.cpp | 4 | ||||
-rw-r--r-- | host/lib/transport/nirio/niusrprio_session.cpp | 2 | ||||
-rw-r--r-- | host/lib/transport/nirio_zero_copy.cpp | 9 | ||||
-rw-r--r-- | host/lib/transport/super_send_packet_handler.hpp | 6 | ||||
-rw-r--r-- | host/lib/transport/tcp_zero_copy.cpp | 6 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 5 | ||||
-rw-r--r-- | host/lib/transport/xport_benchmarker.cpp | 4 |
7 files changed, 21 insertions, 15 deletions
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(); |