diff options
author | Josh Blum | 2012-06-20 13:05:36 -0700 |
---|---|---|
committer | Josh Blum | 2012-06-20 13:05:36 -0700 |
commit | 1827d7faf6030f67dd482d4933fb172150ebd8a6 (patch) | |
tree | 0b0f228d155c80c8a40da69ef1ccc467c5dd41ae /gr-uhd | |
parent | 2294e8c20293bf26a69602011396ffb03763a6d9 (diff) | |
download | gnuradio-1827d7faf6030f67dd482d4933fb172150ebd8a6.tar.gz gnuradio-1827d7faf6030f67dd482d4933fb172150ebd8a6.tar.bz2 gnuradio-1827d7faf6030f67dd482d4933fb172150ebd8a6.zip |
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.
Diffstat (limited to 'gr-uhd')
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_source.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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 <stdexcept> #include <iostream> #include <boost/format.hpp> +#include <boost/thread/thread.hpp> #include <boost/make_shared.hpp> #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 |