diff options
-rw-r--r-- | lib/block_task.cpp | 5 | ||||
-rw-r--r-- | lib/gras_impl/block_actor.hpp | 13 | ||||
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 2 | ||||
-rw-r--r-- | lib/input_handlers.cpp | 2 | ||||
-rw-r--r-- | python/gras/__init__.py | 2 |
5 files changed, 10 insertions, 14 deletions
diff --git a/lib/block_task.cpp b/lib/block_task.cpp index 0ec66ba..52a641c 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -215,7 +215,10 @@ void BlockActor::handle_task(void) //------------------------------------------------------------------ //missing at least one upstream provider? //since nothing else is coming in, its safe to mark done - if (this->any_inputs_done()) this->mark_done(); + for (size_t i = 0; i < num_inputs; i++) + { + if (this->is_input_done(i)) this->mark_done(); + } //still have IO ready? kick off another task if (this->input_queues.all_ready() and this->output_queues.all_ready()) diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp index 7c53a08..27f8400 100644 --- a/lib/gras_impl/block_actor.hpp +++ b/lib/gras_impl/block_actor.hpp @@ -95,17 +95,10 @@ struct BlockActor : Apology::Worker void produce_buffer(const size_t index, const SBuffer &buffer); void flush_output(const size_t index); - GRAS_FORCE_INLINE bool any_inputs_done(void) + GRAS_FORCE_INLINE bool is_input_done(const size_t i) { - if (this->inputs_done.none() or this->input_queues.all_ready()) return false; - for (size_t i = 0; i < this->get_num_inputs(); i++) - { - if (this->inputs_done[i] and not this->input_queues.ready(i)) - { - return true; - } - } - return false; + const bool available = this->input_queues.ready(i) and not this->input_queues.empty(i); + return this->inputs_done[i] and not available; } //per port properties diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index 86483f3..ae38e48 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -113,7 +113,7 @@ struct InputBufferQueues GRAS_FORCE_INLINE bool empty(const size_t i) const { - return not _bitset[i]; + return _queues[i].empty(); } GRAS_FORCE_INLINE bool all_ready(void) const diff --git a/lib/input_handlers.cpp b/lib/input_handlers.cpp index 3493f74..6b60e5c 100644 --- a/lib/input_handlers.cpp +++ b/lib/input_handlers.cpp @@ -42,7 +42,7 @@ void BlockActor::handle_input_check(const InputCheckMessage &message, const Ther //an upstream block declared itself done, recheck the token this->inputs_done.set(index, this->input_tokens[index].unique()); - if (this->any_inputs_done()) //missing an upstream provider + if (this->is_input_done(index)) //missing an upstream provider { this->mark_done(); } diff --git a/python/gras/__init__.py b/python/gras/__init__.py index ee24697..9f613f2 100644 --- a/python/gras/__init__.py +++ b/python/gras/__init__.py @@ -1,5 +1,5 @@ # Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. -from GRAS_Block import Block, Tag +from GRAS_Block import Block, Tag, IOSignature from GRAS_HierBlock import HierBlock, TopBlock from GRAS_ThreadPool import ThreadPoolConfig, ThreadPool |