diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-03-15 16:08:58 +0100 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-03-16 06:53:55 -0400 |
commit | 6a07bc3a829efa5912c31e01d8c1054b61d98b0b (patch) | |
tree | 29ead0ccca6a6f48326cd02249bbaa370372b971 | |
parent | 71b9cbcb29300e6e86b2b8b2d6693f4fc0ca26dd (diff) |
uhd: Replace multi_usrp::recv_async_msg() with tx_stream version
The multi_usrp behaviour is deprecated.
Signed-off-by: Martin Braun <martin.braun@ettus.com>
-rw-r--r-- | gr-uhd/lib/usrp_sink_impl.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index 951d926469..50f676d454 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -16,6 +16,9 @@ #include <chrono> #include <climits> #include <stdexcept> +#include <thread> + +using namespace std::chrono_literals; namespace gr { namespace uhd { @@ -752,10 +755,11 @@ void usrp_sink_impl::async_event_loop() auto time_msg = boost::format("In the last %d ms, %d cmd time errors occurred."); while (_async_event_loop_running) { - while (!_dev->get_device()->recv_async_msg(metadata, 0.1)) { - if (!_async_event_loop_running) { - return; - } + // The Tx Streamer does not exist until start() was called. After that, + // we poll it with a 100ms timeout for async messages. + if (!_tx_stream || !_tx_stream->recv_async_msg(metadata, 0.1)) { + std::this_thread::sleep_for(100ms); + continue; } pmt::pmt_t event_list = pmt::PMT_NIL; |