diff options
author | Martin Braun <martin.braun@ettus.com> | 2014-01-24 14:01:53 +0100 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-01-27 10:12:39 -0800 |
commit | e40e8c27efeb1c09f4e9f20989274e53fcbc602a (patch) | |
tree | 145bdf7bec3acd3b08f01eac3249fdef00f97a55 /gr-uhd/lib/usrp_source_impl.cc | |
parent | f443dbddcceff4054c1da0b78ce08f6505075ad3 (diff) |
uhd: Fix possible freeze-up when using lock/unlock (Solution by Johannes Demel)
Diffstat (limited to 'gr-uhd/lib/usrp_source_impl.cc')
-rw-r--r-- | gr-uhd/lib/usrp_source_impl.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index 318bdb627d..e57db13a0b 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -491,9 +491,12 @@ namespace gr { bool usrp_source_impl::start(void) { + boost::recursive_mutex::scoped_lock lock(d_mutex); #ifdef GR_UHD_USE_STREAM_API - _rx_stream = _dev->get_rx_stream(_stream_args); - _samps_per_packet = _rx_stream->get_max_num_samps(); + if(not _rx_stream){ + _rx_stream = _dev->get_rx_stream(_stream_args); + _samps_per_packet = _rx_stream->get_max_num_samps(); + } #endif //setup a stream command that starts streaming slightly in the future static const double reasonable_delay = 0.1; //order of magnitude over RTT @@ -537,8 +540,8 @@ namespace gr { bool usrp_source_impl::stop(void) { + boost::recursive_mutex::scoped_lock lock(d_mutex); this->issue_stream_cmd(::uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); - this->flush(); return true; @@ -603,6 +606,7 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { + boost::recursive_mutex::scoped_lock lock(d_mutex); #ifdef GR_UHD_USE_STREAM_API //In order to allow for low-latency: //We receive all available packets without timeout. |