[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 05/07: uhd: Fix possible freeze-up when usi
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 05/07: uhd: Fix possible freeze-up when using lock/unlock (Solution by Johannes Demel) |
Date: |
Mon, 27 Jan 2014 20:10:36 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit e40e8c27efeb1c09f4e9f20989274e53fcbc602a
Author: Martin Braun <address@hidden>
Date: Fri Jan 24 14:01:53 2014 +0100
uhd: Fix possible freeze-up when using lock/unlock (Solution by Johannes
Demel)
---
gr-uhd/lib/usrp_source_impl.cc | 10 +++++++---
gr-uhd/lib/usrp_source_impl.h | 5 ++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index 318bdb6..e57db13 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.
diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h
index 58bb215..3cfa1aa 100644
--- a/gr-uhd/lib/usrp_source_impl.h
+++ b/gr-uhd/lib/usrp_source_impl.h
@@ -22,6 +22,7 @@
#include <gnuradio/uhd/usrp_source.h>
#include <uhd/convert.hpp>
+#include <boost/thread/mutex.hpp>
static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("rx_time");
static const pmt::pmt_t RATE_KEY = pmt::string_to_symbol("rx_rate");
@@ -121,7 +122,7 @@ namespace gr {
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
-
+
private:
::uhd::usrp::multi_usrp::sptr _dev;
const ::uhd::stream_args_t _stream_args;
@@ -142,6 +143,8 @@ namespace gr {
//tag shadows
double _samp_rate;
double _center_freq;
+
+ boost::recursive_mutex d_mutex;
};
} /* namespace uhd */
- [Commit-gnuradio] [gnuradio] branch maint updated (411e687 -> 30c7c0e), git, 2014/01/27
- [Commit-gnuradio] [gnuradio] 06/07: changed URL from old svn / utah.edu to gnuradio.org doxygen, git, 2014/01/27
- [Commit-gnuradio] [gnuradio] 07/07: Changing search order for qwt, git, 2014/01/27
- [Commit-gnuradio] [gnuradio] 01/07: grc: fix report window auto-scrolling, git, 2014/01/27
- [Commit-gnuradio] [gnuradio] 05/07: uhd: Fix possible freeze-up when using lock/unlock (Solution by Johannes Demel),
git <=
- [Commit-gnuradio] [gnuradio] 03/07: Merge remote-tracking branch 'gnuradio-wg-grc/grc_report_window_autoscroll_fix' into maint, git, 2014/01/27
- [Commit-gnuradio] [gnuradio] 02/07: docs: Netwrok -> Network (satisfy OCD), git, 2014/01/27
- [Commit-gnuradio] [gnuradio] 04/07: Merge remote-tracking branch 'martin/docs-fix2' into maint, git, 2014/01/27