From b59b9ed3a7f62d2a6d7933a18b11b0b29c33c689 Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Wed, 11 Sep 2019 15:05:53 -0500 Subject: 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. --- host/lib/rfnoc/rfnoc_graph.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'host/lib/rfnoc/rfnoc_graph.cpp') 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 // FIXME remove when rfnoc_device is ready #include +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(num_chans, args); + _rx_streamers.push_back(boost::make_shared(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(num_chans, args); + _tx_streamers.push_back(boost::make_shared(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 _pkt_factory; + + //! Reference to RX streamers + std::vector _rx_streamers; + + //! Reference to TX streamers + std::vector _tx_streamers; }; /* class rfnoc_graph_impl */ -- cgit v1.2.3