summaryrefslogtreecommitdiff
path: root/lib/block_handlers.cpp
diff options
context:
space:
mode:
authorJosh Blum2012-09-07 20:46:31 -0700
committerJosh Blum2012-09-07 20:46:31 -0700
commitd80ca1ce3e89db619d0b65b8b8c44fe8d3ba6a93 (patch)
treea5ddf6926820b71ee212712112491f98a334fe87 /lib/block_handlers.cpp
parentbe3195c9a61ff726c2f13a6ae9e33d586bebce3b (diff)
downloadsandhi-d80ca1ce3e89db619d0b65b8b8c44fe8d3ba6a93.tar.gz
sandhi-d80ca1ce3e89db619d0b65b8b8c44fe8d3ba6a93.tar.bz2
sandhi-d80ca1ce3e89db619d0b65b8b8c44fe8d3ba6a93.zip
call start/stop hooks on block state change
Diffstat (limited to 'lib/block_handlers.cpp')
-rw-r--r--lib/block_handlers.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp
index b62df4e..c9d97bb 100644
--- a/lib/block_handlers.cpp
+++ b/lib/block_handlers.cpp
@@ -87,6 +87,10 @@ void ElementImpl::handle_block_msg(
if (msg.cast<TopBlockMessage>().what == TopBlockMessage::ACTIVE)
{
+ if (this->block_state != BLOCK_STATE_LIVE)
+ {
+ this->block_ptr->start();
+ }
this->block_state = BLOCK_STATE_LIVE;
if (this->input_queues.all_ready() and this->output_queues.all_ready())
{
@@ -96,6 +100,10 @@ void ElementImpl::handle_block_msg(
if (msg.cast<TopBlockMessage>().what == TopBlockMessage::INERT)
{
+ if (this->block_state != BLOCK_STATE_DONE)
+ {
+ this->block_ptr->stop();
+ }
this->mark_done(task_iface);
}
}