From 692890cd40aa07a8290c7fdee24c94b6a0eabb8c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 29 Sep 2012 20:14:51 -0700 Subject: uhd: work does not block, OK to return 0 on ERROR_CODE_TIMEOUT --- gr-uhd/lib/gr_uhd_usrp_source.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index 139caf9dd..3813673b4 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -338,8 +338,8 @@ public: //If receive resulted in a timeout condition: //We now receive a single packet with a large timeout. - while (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){ - if (boost::this_thread::interruption_requested()) return WORK_DONE; + if (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) + { num_samps = _rx_stream->recv( output_items, noutput_items, _metadata, 0.1, true/*one pkt*/ ); @@ -377,9 +377,8 @@ public: break; case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: - //Assume that the user called stop() on the flow graph. - //However, a timeout can occur under error conditions. - return WORK_DONE; + //its ok to timeout, perhaps the user is doing finite streaming + return 0; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: _tag_now = true; -- cgit