diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/rfnoc/rx_stream_terminator.cpp | 6 | ||||
-rw-r--r-- | host/lib/rfnoc/rx_stream_terminator.hpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/host/lib/rfnoc/rx_stream_terminator.cpp b/host/lib/rfnoc/rx_stream_terminator.cpp index e05d9cd49..7d38e2101 100644 --- a/host/lib/rfnoc/rx_stream_terminator.cpp +++ b/host/lib/rfnoc/rx_stream_terminator.cpp @@ -63,6 +63,12 @@ void rx_stream_terminator::set_rx_streamer(bool active, const size_t) void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> streamer, const size_t) { + std::unique_lock<std::mutex> l(_overrun_handler_mutex, std::defer_lock); + if (!l.try_lock()) { + // We're already handling overruns, so just stop right there + return; + } + std::vector<boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> > upstream_radio_nodes = find_upstream_node<uhd::rfnoc::radio_ctrl_impl>(); const size_t n_radios = upstream_radio_nodes.size(); diff --git a/host/lib/rfnoc/rx_stream_terminator.hpp b/host/lib/rfnoc/rx_stream_terminator.hpp index 5159cd34a..fb205d00c 100644 --- a/host/lib/rfnoc/rx_stream_terminator.hpp +++ b/host/lib/rfnoc/rx_stream_terminator.hpp @@ -24,6 +24,7 @@ #include <uhd/rfnoc/scalar_node_ctrl.hpp> #include <uhd/rfnoc/terminator_node_ctrl.hpp> #include <uhd/rfnoc/block_ctrl_base.hpp> // For the block macros +#include <mutex> namespace uhd { namespace rfnoc { @@ -78,6 +79,8 @@ private: double _samp_rate; double _tick_rate; + std::mutex _overrun_handler_mutex; + }; /* class rx_stream_terminator */ }} /* namespace uhd::rfnoc */ |