diff options
author | Josh Blum <josh@joshknows.com> | 2010-09-30 14:36:24 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-09-30 14:36:24 -0700 |
commit | 2c8a7c7debf19d92065661cc1d258f97bd38e224 (patch) | |
tree | 93723da79bd0dc800529e80aa6411d1c187970a5 /host/lib/usrp/usrp2 | |
parent | e4fffed05dda57bb37d693a3a26ea6a903c925f7 (diff) | |
download | uhd-2c8a7c7debf19d92065661cc1d258f97bd38e224.tar.gz uhd-2c8a7c7debf19d92065661cc1d258f97bd38e224.tar.bz2 uhd-2c8a7c7debf19d92065661cc1d258f97bd38e224.zip |
uhd: implemented recv timeout for zero copy interface
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 65411801d..3395f94e2 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -33,6 +33,7 @@ using namespace uhd::transport; namespace asio = boost::asio; static const int underflow_flags = async_metadata_t::EVENT_CODE_UNDERFLOW | async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET; +static const double RECV_TIMEOUT_MS = 100; /*********************************************************************** * io impl details (internal to this file) @@ -90,7 +91,7 @@ void usrp2_impl::io_impl::recv_pirate_loop( size_t next_packet_seq = 0; while(recv_pirate_crew_raiding){ - managed_recv_buffer::sptr buff = zc_if->get_recv_buff(); + managed_recv_buffer::sptr buff = zc_if->get_recv_buff(RECV_TIMEOUT_MS); if (not buff.get()) continue; //ignore timeout/error buffers try{ @@ -150,7 +151,7 @@ void usrp2_impl::io_init(void){ std::memcpy(send_buff->cast<void*>(), &data, sizeof(data)); send_buff->commit(sizeof(data)); //drain the recv buffers (may have junk) - while (data_transport->get_recv_buff().get()){}; + while (data_transport->get_recv_buff(RECV_TIMEOUT_MS).get()){}; } //the number of recv frames is the number for the first transport |