diff options
author | Josh Blum | 2013-01-31 21:47:30 -0800 |
---|---|---|
committer | Josh Blum | 2013-01-31 21:47:30 -0800 |
commit | 3966ed72ba0aa187c0065efc15c3cb9fe0020447 (patch) | |
tree | 03109f7ab07c511671e07f174c2bb9fb383489d9 | |
parent | 8a624ecbe5a0e5ec720a2bc02baa1b2a93a47790 (diff) | |
download | sandhi-3966ed72ba0aa187c0065efc15c3cb9fe0020447.tar.gz sandhi-3966ed72ba0aa187c0065efc15c3cb9fe0020447.tar.bz2 sandhi-3966ed72ba0aa187c0065efc15c3cb9fe0020447.zip |
gras: simplify task kicker into a reusable call
-rw-r--r-- | lib/block_handlers.cpp | 2 | ||||
-rw-r--r-- | lib/block_task.cpp | 7 | ||||
-rw-r--r-- | lib/gras_impl/block_actor.hpp | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp index 87c5ee4..5b6a1c0 100644 --- a/lib/block_handlers.cpp +++ b/lib/block_handlers.cpp @@ -27,7 +27,7 @@ void BlockActor::handle_top_active( //when I do the kick, but not with the direct call to handle //ideally, we always kick here and let the kick handler call handle_task this->handle_task(); - //this->Push(SelfKickMessage(), Theron::Address()); + //this->task_kicker(); } void BlockActor::handle_top_inert( diff --git a/lib/block_task.cpp b/lib/block_task.cpp index 6796d1e..3d8bca1 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -60,7 +60,7 @@ void BlockActor::input_fail(const size_t i) if (not this->input_queues.is_accumulated(i)) { this->input_queues.accumulate(i); - this->Push(SelfKickMessage(), Theron::Address()); + this->task_kicker(); return; } @@ -225,10 +225,7 @@ void BlockActor::handle_task(void) } //still have IO ready? kick off another task - if (this->is_work_allowed()) - { - this->Push(SelfKickMessage(), Theron::Address()); - } + this->task_kicker(); } void BlockActor::consume(const size_t i, const size_t items) diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp index 24143a1..7e9dd6b 100644 --- a/lib/gras_impl/block_actor.hpp +++ b/lib/gras_impl/block_actor.hpp @@ -98,6 +98,11 @@ struct BlockActor : Apology::Worker void flush_output(const size_t index); bool is_work_allowed(void); + GRAS_FORCE_INLINE void task_kicker(void) + { + if (this->is_work_allowed()) this->TailSend(SelfKickMessage(), this->GetAddress()); + } + GRAS_FORCE_INLINE bool is_input_done(const size_t i) { const bool available = this->input_queues.ready(i) and not this->input_queues.empty(i); |