diff options
author | Josh Blum | 2013-03-17 14:20:27 -0700 |
---|---|---|
committer | Josh Blum | 2013-03-17 14:20:27 -0700 |
commit | f637a4081cef9d28d98e209efbd02099c56777a9 (patch) | |
tree | b7f07bf45faeb129b3147a7120fd9a7ee10a4e8f /lib/gras_impl/block_actor.hpp | |
parent | 4e19b066d27b90355657688f67b6e2f208390a82 (diff) | |
parent | 61f2af4f8287665d91478575793399043e6c00f7 (diff) | |
download | sandhi-f637a4081cef9d28d98e209efbd02099c56777a9.tar.gz sandhi-f637a4081cef9d28d98e209efbd02099c56777a9.tar.bz2 sandhi-f637a4081cef9d28d98e209efbd02099c56777a9.zip |
Merge branch 'master' into property_interface
Diffstat (limited to 'lib/gras_impl/block_actor.hpp')
-rw-r--r-- | lib/gras_impl/block_actor.hpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp index d7429f1..8efc388 100644 --- a/lib/gras_impl/block_actor.hpp +++ b/lib/gras_impl/block_actor.hpp @@ -33,7 +33,22 @@ struct BlockActor : Apology::Worker ThreadPool thread_pool; //! Priority count to hack in high-prio worker queue - Theron::Detail::Atomic::UInt32 prio_count; + Theron::Detail::Atomic::UInt32 prioCount; + GRAS_FORCE_INLINE void highPrioPreNotify(void) + { + this->prioCount.Increment(); + } + GRAS_FORCE_INLINE void highPrioAck(void) + { + ASSERT(this->prioCount.Load() != 0); + this->prioCount.Decrement(); + this->handle_task(); + } + GRAS_FORCE_INLINE bool hasHighPrioMsg(void) + { + //high prio when the count is positive and there are enqueued messages (avoids race) + return this->prioCount.Load() and this->GetNumQueuedMessages(); + } //do it here so we can match w/ the handler declarations void register_handlers(void) @@ -123,10 +138,8 @@ struct BlockActor : Apology::Worker GRAS_FORCE_INLINE bool is_work_allowed(void) { - //high prio when the count is positive and there are enqueued messages (avoids race) - const bool has_high_prio_msg = this->prio_count.Load() and this->GetNumQueuedMessages(); return ( - not has_high_prio_msg and + not this->hasHighPrioMsg() and this->block_state == BLOCK_STATE_LIVE and this->input_queues.all_ready() and this->inputs_available.any() and |