summaryrefslogtreecommitdiff
path: root/lib/block_task.cpp
diff options
context:
space:
mode:
authorJosh Blum2012-11-23 11:29:06 -0800
committerJosh Blum2012-11-23 11:29:06 -0800
commit45dd52310ad88b6ea249b310178599a892427648 (patch)
tree19777569e5349a100cd60d3b837ab5949650117c /lib/block_task.cpp
parent55c68e6f7a2703bfd6566b0b26151e196d7ea62d (diff)
downloadsandhi-45dd52310ad88b6ea249b310178599a892427648.tar.gz
sandhi-45dd52310ad88b6ea249b310178599a892427648.tar.bz2
sandhi-45dd52310ad88b6ea249b310178599a892427648.zip
async atomic notification of stop condition
Diffstat (limited to 'lib/block_task.cpp')
-rw-r--r--lib/block_task.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/block_task.cpp b/lib/block_task.cpp
index 7f40f47..0af7cb1 100644
--- a/lib/block_task.cpp
+++ b/lib/block_task.cpp
@@ -113,6 +113,16 @@ void BlockActor::handle_task(void)
this->output_queues.all_ready()
)) return;
+ //------------------------------------------------------------------
+ //-- Asynchronous notification through atomic variable
+ //-- that the executor has instructed workers to stop.
+ //------------------------------------------------------------------
+ if (active_token.expired())
+ {
+ this->mark_done();
+ return;
+ }
+
const size_t num_inputs = this->get_num_inputs();
const size_t num_outputs = this->get_num_outputs();