From 2464a5780736b71c23cc46d031a62ff30e35d969 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 27 Apr 2013 13:05:09 -0700 Subject: gras: moved flush output to consume function in output queues This cleans up some code in block actor. The message sending code is now in task_main, and the consume routine is now the shared one. --- lib/gras_impl/output_buffer_queues.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/gras_impl/output_buffer_queues.hpp') diff --git a/lib/gras_impl/output_buffer_queues.hpp b/lib/gras_impl/output_buffer_queues.hpp index deea0e1..251de96 100644 --- a/lib/gras_impl/output_buffer_queues.hpp +++ b/lib/gras_impl/output_buffer_queues.hpp @@ -53,6 +53,19 @@ struct OutputBufferQueues return _queues[i]->front(); } + GRAS_FORCE_INLINE void consume(const size_t i) + { + ASSERT(not this->empty(i)); + SBuffer &buff = this->front(i); + if GRAS_UNLIKELY(buff.length == 0) return; + + //increment buffer for next use + buff.offset += buff.length; + buff.length = 0; + + this->pop(i); + } + GRAS_FORCE_INLINE void pop(const size_t i) { ASSERT(_queues[i]); -- cgit