From 3b59529e71549976eaa99b75f40df732a8b73d6d Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 10 Apr 2020 11:39:42 -0700 Subject: multi_usrp: Approximate legacy behaviour for recv_async_msg() When using multi_usrp with an RFNoC device, the previous behaviour was to throw an exception when calling recv_async_msg() so users would know they're not supposed to call it (calling tx_stream::recv_async_msg is preferred). However, this breaks too many existing applications. Instead, we keep a weak pointer to the streamer, the same way that older devices do, and query the async message from that. This means that calling recv_async_msg() when there are multiple streamers can lead to unexpected behaviour, but that's a general issue with multi_usrp::recv_async_msg() and this way, the RFNoC devices now behave like older devices do. --- host/include/uhd/device.hpp | 11 ++++------- host/include/uhd/usrp/multi_usrp.hpp | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'host/include') diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp index 38424c866..7fffc59b6 100644 --- a/host/include/uhd/device.hpp +++ b/host/include/uhd/device.hpp @@ -87,18 +87,15 @@ public: */ virtual tx_streamer::sptr get_tx_stream(const stream_args_t& args) = 0; - /*! Receive asynchronous message from the device + /*! DEPRECATED: Receive asynchronous message from the device * - * Note that when calling multi_usrp::get_device() on an RFNoC-capable device, - * the returned uhd::device (while still being a valid object) will not be - * able to execute this method. Instead, query the asynchronous messages - * from the appropriate Tx streamer. + * Prefer calling recv_async_msg on the associated TX streamer. This method + * has the problem that it doesn't necessarily know which Tx streamer is + * being addressed, and thus might not be delivering the expected outcome. * * \param async_metadata the metadata to be filled in * \param timeout the timeout in seconds to wait for a message * \return true when the async_metadata is valid, false for timeout - * \throws uhd::runtime_error if called on a device returned by - * multi_usrp::get_device on an RFNoC device. */ virtual bool recv_async_msg( async_metadata_t& async_metadata, double timeout = 0.1) = 0; diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 5d86370c6..53e63361f 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -129,7 +129,7 @@ public: * For RFNoC devices, this won't return a true uhd::device anyway, because * direct device access is locked for those. The returned pointer will * still point to a valid device object, however, it has reduced - * functionality (in particular, recv_async_msg() won't work). + * functionality. * * \return the device object within this USRP */ -- cgit v1.2.3