diff options
author | Josh Blum | 2012-11-18 19:23:17 -0800 |
---|---|---|
committer | Josh Blum | 2012-11-18 19:23:17 -0800 |
commit | eaaf23409d7748409a343a39eb8087216057d3da (patch) | |
tree | 8f6a3e4c5a667f8f359defe87c2f79b6b2c4796f /lib | |
parent | 308a2403b23888c3f1d2b1ff3b579c1b17450cf1 (diff) | |
download | sandhi-eaaf23409d7748409a343a39eb8087216057d3da.tar.gz sandhi-eaaf23409d7748409a343a39eb8087216057d3da.tar.bz2 sandhi-eaaf23409d7748409a343a39eb8087216057d3da.zip |
improvements to done logic (helps reserve 0 case)
Diffstat (limited to 'lib')
-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 |
4 files changed, 9 insertions, 13 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(); } |