diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-08-14 12:10:32 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-08-17 15:07:14 -0500 |
commit | 5333d0d9323325dbb6321188852ccd48d54cb47a (patch) | |
tree | b04d958251dac4c7f3306db295e2a62536395e79 /host | |
parent | 9ed42affcaa88e026cb4f82807e69b546ed30c8c (diff) | |
download | uhd-5333d0d9323325dbb6321188852ccd48d54cb47a.tar.gz uhd-5333d0d9323325dbb6321188852ccd48d54cb47a.tar.bz2 uhd-5333d0d9323325dbb6321188852ccd48d54cb47a.zip |
multi_usrp: Use multi_usrp::sptrs in graph disconnect lambdas
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/multi_usrp_rfnoc.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index c937cb892..26932ef30 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -157,7 +157,8 @@ std::string bytes_to_str(std::vector<uint8_t> str_b) } // namespace -class multi_usrp_rfnoc : public multi_usrp +class multi_usrp_rfnoc : public multi_usrp, + public std::enable_shared_from_this<multi_usrp_rfnoc> { public: struct rx_chan_t @@ -287,11 +288,12 @@ public: // Create the streamer // The disconnect callback must disconnect the entire chain because the radio // relies on the connections to determine what is enabled. - auto rx_streamer = std::make_shared<rfnoc_rx_streamer>(args.channels.size(), + auto this_multi_usrp = shared_from_this(); + auto rx_streamer = std::make_shared<rfnoc_rx_streamer>(args.channels.size(), args, - [this, channels = args.channels](const std::string& id) { - this->_graph->disconnect(id); - this->_disconnect_rx_chains(channels); + [channels = args.channels, this_multi_usrp](const std::string& id) { + this_multi_usrp->_graph->disconnect(id); + this_multi_usrp->_disconnect_rx_chains(channels); }); // Connect the streamer @@ -361,11 +363,12 @@ public: // Create a streamer // The disconnect callback must disconnect the entire chain because the radio // relies on the connections to determine what is enabled. - auto tx_streamer = std::make_shared<rfnoc_tx_streamer>(args.channels.size(), + auto this_multi_usrp = shared_from_this(); + auto tx_streamer = std::make_shared<rfnoc_tx_streamer>(args.channels.size(), args, - [this, channels = args.channels](const std::string& id) { - this->_graph->disconnect(id); - this->_disconnect_tx_chains(channels); + [channels = args.channels, this_multi_usrp](const std::string& id) { + this_multi_usrp->_graph->disconnect(id); + this_multi_usrp->_disconnect_tx_chains(channels); }); // Connect the streamer |