From 1fd57936765fd19c51842ce2bfec41abb9146eaf Mon Sep 17 00:00:00 2001 From: jcorgan Date: Tue, 17 Feb 2009 16:57:00 +0000 Subject: [PATCH] Added ability to determine if flowgraph is running git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10451 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/runtime/gr_top_block.cc | 6 ++++++ gnuradio-core/src/lib/runtime/gr_top_block.h | 5 +++++ gnuradio-core/src/lib/runtime/gr_top_block.i | 1 + gnuradio-core/src/lib/runtime/gr_top_block_impl.cc | 6 ++++++ gnuradio-core/src/lib/runtime/gr_top_block_impl.h | 3 +++ 5 files changed, 21 insertions(+) diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc index 09e46dfb..3fa32425 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc @@ -78,6 +78,12 @@ gr_top_block::run() wait(); } +bool +gr_top_block::is_running() +{ + return d_impl->is_running(); +} + void gr_top_block::lock() { diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index b47ec019..415bb21f 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -77,6 +77,11 @@ public: */ void wait(); + /*! + * Is the flowgraph running? + */ + bool is_running(); + /*! * Lock a flowgraph in preparation for reconfiguration. When an equal * number of calls to lock() and unlock() have occurred, the flowgraph diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i index 670e5b5e..b5ced3cd 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.i +++ b/gnuradio-core/src/lib/runtime/gr_top_block.i @@ -44,6 +44,7 @@ public: void stop(); void wait(); void run(); + bool is_running(); void lock(); void unlock() throw (std::runtime_error); void dump(); diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc index 50d480d0..97b19ada 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc @@ -87,6 +87,12 @@ gr_top_block_impl::~gr_top_block_impl() d_owner = 0; } +bool +gr_top_block_impl::is_running() +{ + return (d_state != IDLE); +} + void gr_top_block_impl::start() { diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h index 35fb44ef..794c4bc0 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h @@ -60,6 +60,9 @@ public: // Dump the flowgraph to stdout void dump(); + + // Has flowgraph been started? + bool is_running(); protected: -- 2.47.2