aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/rfnoc
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-11-12 10:28:31 -0800
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:33 -0800
commit59fae330b0345c4a587862322b16379e563e673b (patch)
tree4b686e3239d0811f98ab1a63bc321812f0baef52 /host/lib/include/uhdlib/rfnoc
parent59a436038445613b6552c804601297405d736fce (diff)
downloaduhd-59fae330b0345c4a587862322b16379e563e673b.tar.gz
uhd-59fae330b0345c4a587862322b16379e563e673b.tar.bz2
uhd-59fae330b0345c4a587862322b16379e563e673b.zip
detail::graph: Add shutdown capability
In the existing graph, when the shutdown was simply a release. However, any outstanding actions would trigger warnings (because released graphs aren't supposed to still have actions being passed around), which would sometimes be visible at the end of an application. This is a safer solution than simply releasing, because it explicitly sets a shutdown flag that all graph-affecting functions (property propagation and action handling) respect. Once the flag is set, the graph can no longer be booted up again.
Diffstat (limited to 'host/lib/include/uhdlib/rfnoc')
-rw-r--r--host/lib/include/uhdlib/rfnoc/graph.hpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/graph.hpp b/host/lib/include/uhdlib/rfnoc/graph.hpp
index 286f2303f..c7b06d636 100644
--- a/host/lib/include/uhdlib/rfnoc/graph.hpp
+++ b/host/lib/include/uhdlib/rfnoc/graph.hpp
@@ -63,6 +63,15 @@ public:
*/
void release();
+ /*! Shutdown graph: Permenanently release
+ *
+ * This will release the graph permanently and safely. All ongoing property
+ * and action handling is completed and then disabled (this means that
+ * calling shutdown while blocks are still working will cause actions to not
+ * get delivered).
+ */
+ void shutdown();
+
/*! Return a list of all edges
*/
std::vector<graph_edge_t> enumerate_edges();
@@ -271,16 +280,15 @@ private:
//! Flag to ensure serialized handling of actions
std::atomic_flag _action_handling_ongoing;
- //! Mutex for to avoid the user from sending one message before another
- // message is sent
- std::recursive_mutex _action_mutex;
-
//! Changes to the release/commit state of the graph are locked with this mutex
std::recursive_mutex _release_mutex;
//! This counter gets decremented everytime commit() is called. When zero,
// the graph is committed.
size_t _release_count{1};
+
+ //! A flag if the graph has shut down. Is protected by _release_mutex
+ bool _shutdown{false};
};