From 1827d7faf6030f67dd482d4933fb172150ebd8a6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jun 2012 13:05:36 -0700 Subject: uhd: source will loop for samples forever until thread interrupt This should solve the case of stopping the receiver, while leaving the work thread in a live state. It also makes set stream time work for times > timeout. --- gr-uhd/lib/gr_uhd_usrp_source.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gr-uhd') diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index 8aa965401..876bf400d 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "gr_uhd_common.h" @@ -330,9 +331,10 @@ public: //If receive resulted in a timeout condition: //We now receive a single packet with a large timeout. - if (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){ + while (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){ + if (boost::this_thread::interruption_requested()) return WORK_DONE; num_samps = _rx_stream->recv( - output_items, noutput_items, _metadata, 1.0, true/*one pkt*/ + output_items, noutput_items, _metadata, 0.1, true/*one pkt*/ ); } #else -- cgit