diff options
| author | Ciro Nishiguchi <ciro.nishiguchi@ni.com> | 2019-09-11 15:05:53 -0500 | 
|---|---|---|
| committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:43 -0800 | 
| commit | b59b9ed3a7f62d2a6d7933a18b11b0b29c33c689 (patch) | |
| tree | 6b88b27324618e861d6b1678bf073e6ac5d9eae8 | |
| parent | 0e2464ad888230054b04a4f3fb192ea8dc5721b0 (diff) | |
| download | uhd-b59b9ed3a7f62d2a6d7933a18b11b0b29c33c689.tar.gz uhd-b59b9ed3a7f62d2a6d7933a18b11b0b29c33c689.tar.bz2 uhd-b59b9ed3a7f62d2a6d7933a18b11b0b29c33c689.zip  | |
rfnoc: Hold reference to streamers in rfnoc_graph
Add a shared pointer to the streamers to the rfnoc_graph, so that the
streamers are not deallocated before the graph. Nodes in the graph,
including the streamers, must remain in memory until the graph is no
longer needed.
| -rw-r--r-- | host/lib/rfnoc/rfnoc_graph.cpp | 13 | 
1 files changed, 11 insertions, 2 deletions
diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp index 85e403cbe..60afbdad5 100644 --- a/host/lib/rfnoc/rfnoc_graph.cpp +++ b/host/lib/rfnoc/rfnoc_graph.cpp @@ -23,6 +23,7 @@  #include <boost/shared_ptr.hpp> // FIXME remove when rfnoc_device is ready  #include <memory> +using namespace uhd;  using namespace uhd::rfnoc;  namespace { @@ -322,13 +323,15 @@ public:      uhd::rx_streamer::sptr create_rx_streamer(          const size_t num_chans, const uhd::stream_args_t& args)      { -        return boost::make_shared<rfnoc_rx_streamer>(num_chans, args); +        _rx_streamers.push_back(boost::make_shared<rfnoc_rx_streamer>(num_chans, args)); +        return _rx_streamers.back();      }      uhd::tx_streamer::sptr create_tx_streamer(          const size_t num_chans, const uhd::stream_args_t& args)      { -        return boost::make_shared<rfnoc_tx_streamer>(num_chans, args); +        _tx_streamers.push_back(boost::make_shared<rfnoc_tx_streamer>(num_chans, args)); +        return _tx_streamers.back();      }      size_t get_num_mboards() const @@ -874,6 +877,12 @@ private:      //! Reference to a packet factory object. Gets initialized just before the GSM      std::unique_ptr<chdr::chdr_packet_factory> _pkt_factory; + +    //! Reference to RX streamers +    std::vector<rx_streamer::sptr> _rx_streamers; + +    //! Reference to TX streamers +    std::vector<tx_streamer::sptr> _tx_streamers;  }; /* class rfnoc_graph_impl */  | 
