aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-06-07 21:37:15 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:27 -0800
commit6bd43946a71173cbf0f1d318843ba34d6849dc30 (patch)
tree35e0b46fc8e399718d6adafcda0929c86e0035ad /host/lib/include
parent491a74269e7d7d7589119c22f229c994d8a2c3f8 (diff)
downloaduhd-6bd43946a71173cbf0f1d318843ba34d6849dc30.tar.gz
uhd-6bd43946a71173cbf0f1d318843ba34d6849dc30.tar.bz2
uhd-6bd43946a71173cbf0f1d318843ba34d6849dc30.zip
rfnoc: Add shutdown feature to blocks
On destruction, the rfnoc_graph will call shutdown() on all blocks. This allows a safe de-initialization of blocks independent of the lifetime of the noc_block_base::sptr. Also adds the shutdown feature to null_block_control.
Diffstat (limited to 'host/lib/include')
-rw-r--r--host/lib/include/uhdlib/rfnoc/block_container.hpp6
-rw-r--r--host/lib/include/uhdlib/rfnoc/node_accessor.hpp9
2 files changed, 15 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/block_container.hpp b/host/lib/include/uhdlib/rfnoc/block_container.hpp
index e32feed52..b43a7bc61 100644
--- a/host/lib/include/uhdlib/rfnoc/block_container.hpp
+++ b/host/lib/include/uhdlib/rfnoc/block_container.hpp
@@ -43,6 +43,12 @@ public:
*/
noc_block_base::sptr get_block(const block_id_t& block_id) const;
+ /*! Call shutdown() on all blocks
+ *
+ * After calling this, blocks won't be able to do anything anymore!
+ */
+ void shutdown();
+
private:
//! Lock access to the storage
mutable std::mutex _mutex;
diff --git a/host/lib/include/uhdlib/rfnoc/node_accessor.hpp b/host/lib/include/uhdlib/rfnoc/node_accessor.hpp
index 3351c5531..93e2733cf 100644
--- a/host/lib/include/uhdlib/rfnoc/node_accessor.hpp
+++ b/host/lib/include/uhdlib/rfnoc/node_accessor.hpp
@@ -108,6 +108,15 @@ public:
{
return node->check_topology(connected_inputs, connected_outputs);
}
+
+ /*! Put a node into shutdown
+ *
+ * See node_t::shutdown(), and also noc_block_base::shutdown() for details.
+ */
+ void shutdown(node_t* node)
+ {
+ node->shutdown();
+ }
};