diff options
author | Josh Blum | 2013-03-29 01:20:49 -0700 |
---|---|---|
committer | Josh Blum | 2013-03-29 01:20:49 -0700 |
commit | d6f413965cc91fd239f7ba587e9550233b386cc5 (patch) | |
tree | 8cf0bcc33cfb2b3947c7d2a3c973653665337a8f /lib/gras_impl | |
parent | 56a17f61079869830483709f5f6366923c735d7c (diff) | |
download | sandhi-d6f413965cc91fd239f7ba587e9550233b386cc5.tar.gz sandhi-d6f413965cc91fd239f7ba587e9550233b386cc5.tar.bz2 sandhi-d6f413965cc91fd239f7ba587e9550233b386cc5.zip |
gras: fix #66 with less lazy flush_all for input queue
Diffstat (limited to 'lib/gras_impl')
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index 6886e6e..51ff3e6 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -105,12 +105,6 @@ struct InputBufferQueues void push(const size_t i, const SBuffer &buffer); - GRAS_FORCE_INLINE void flush(const size_t i) - { - _queues[i].clear(); - _bitset.reset(i); - } - GRAS_FORCE_INLINE void fail(const size_t i) { _bitset.reset(i); @@ -123,9 +117,13 @@ struct InputBufferQueues GRAS_FORCE_INLINE void flush_all(void) { - const size_t old_size = this->size(); - this->resize(0); - this->resize(old_size); + //clear all data in queues and update vars to reflect + for (size_t i = 0; i < this->size(); i++) + { + _queues[i] = boost::circular_buffer<SBuffer>(1); + _enqueued_bytes[i] = 0; + this->__update(i); + } } GRAS_FORCE_INLINE bool ready(const size_t i) const @@ -165,14 +163,10 @@ GRAS_FORCE_INLINE void InputBufferQueues::resize(const size_t size) _enqueued_bytes.resize(size, 0); _queues.resize(size, boost::circular_buffer<SBuffer>(1)); _aux_queues.resize(size); - - if (size != 0) //keep config info when flushing - { - _items_sizes.resize(size, 0); - _preload_bytes.resize(size, 0); - _reserve_bytes.resize(size, 1); - _maximum_bytes.resize(size, MAX_AUX_BUFF_BYTES); - } + _items_sizes.resize(size, 0); + _preload_bytes.resize(size, 0); + _reserve_bytes.resize(size, 1); + _maximum_bytes.resize(size, MAX_AUX_BUFF_BYTES); } inline void InputBufferQueues::update_config( |