summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/top_block_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/lib/top_block_impl.cc')
-rw-r--r--gnuradio-runtime/lib/top_block_impl.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/gnuradio-runtime/lib/top_block_impl.cc b/gnuradio-runtime/lib/top_block_impl.cc
index 48404a6832..3f94867bc2 100644
--- a/gnuradio-runtime/lib/top_block_impl.cc
+++ b/gnuradio-runtime/lib/top_block_impl.cc
@@ -80,7 +80,7 @@ namespace gr {
top_block_impl::top_block_impl(top_block *owner)
: d_owner(owner), d_ffg(),
- d_state(IDLE), d_lock_count(0)
+ d_state(IDLE), d_lock_count(0), d_retry_wait(false)
{
}
@@ -125,8 +125,12 @@ namespace gr {
void
top_block_impl::stop()
{
+ gr::thread::scoped_lock lock(d_mutex);
+
if(d_scheduler)
d_scheduler->stop();
+
+ d_state = IDLE;
}
void
@@ -137,6 +141,11 @@ namespace gr {
{
gr::thread::scoped_lock lock(d_mutex);
if (!d_lock_count) {
+ if(d_retry_wait) {
+ d_retry_wait = false;
+ continue;
+ }
+ d_state = IDLE;
break;
}
d_lock_cond.wait(lock);
@@ -149,8 +158,6 @@ namespace gr {
{
if(d_scheduler)
d_scheduler->wait();
-
- d_state = IDLE;
}
// N.B. lock() and unlock() cannot be called from a flow graph
@@ -159,7 +166,8 @@ namespace gr {
top_block_impl::lock()
{
gr::thread::scoped_lock lock(d_mutex);
- stop();
+ if(d_scheduler)
+ d_scheduler->stop();
d_lock_count++;
}
@@ -177,8 +185,8 @@ namespace gr {
if(d_lock_count > 0 || d_state == IDLE) // nothing to do
return;
- d_lock_cond.notify_all();
restart();
+ d_lock_cond.notify_all();
}
/*
@@ -197,7 +205,7 @@ namespace gr {
// Create a new scheduler to execute it
d_scheduler = make_scheduler(d_ffg, d_max_noutput_items);
- d_state = RUNNING;
+ d_retry_wait = true;
}
std::string