summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosh Blum2012-11-07 01:16:49 -0800
committerJosh Blum2012-11-07 01:16:49 -0800
commit4e6548ed237f3d6eda4383d6a07a4d1e99f404f6 (patch)
tree6b10f8d47259eb831eec88c07f95b7bfbc6b3fb4 /lib
parent0f0c68c4a8c32c43eee8f1589878abe376e2b1da (diff)
downloadsandhi-4e6548ed237f3d6eda4383d6a07a4d1e99f404f6.tar.gz
sandhi-4e6548ed237f3d6eda4383d6a07a4d1e99f404f6.tar.bz2
sandhi-4e6548ed237f3d6eda4383d6a07a4d1e99f404f6.zip
some fixes from the last commit
Diffstat (limited to 'lib')
-rw-r--r--lib/block_task.cpp20
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp16
2 files changed, 21 insertions, 15 deletions
diff --git a/lib/block_task.cpp b/lib/block_task.cpp
index cfe5bb0..ee4d075 100644
--- a/lib/block_task.cpp
+++ b/lib/block_task.cpp
@@ -75,13 +75,6 @@ void BlockActor::input_fail(const size_t i)
{
SBuffer &buff = this->input_queues.front(i);
- //check that the input is not already maxed
- const size_t front_items = buff.length/this->input_items_sizes[i];
- if (front_items >= this->input_configs[i].maximum_items)
- {
- //throw std::runtime_error("input_fail called on maximum_items buffer");
- }
-
//input failed, accumulate and try again
if (not this->input_queues.is_accumulated(i))
{
@@ -91,7 +84,18 @@ void BlockActor::input_fail(const size_t i)
}
//otherwise check for done, else wait for more
- if (this->inputs_done[i]) this->mark_done();
+ if (this->inputs_done[i])
+ {
+ this->mark_done();
+ return;
+ }
+
+ //check that the input is not already maxed
+ const size_t front_items = buff.length/this->input_items_sizes[i];
+ if (front_items >= this->input_configs[i].maximum_items)
+ {
+ //throw std::runtime_error("input_fail called on maximum_items buffer");
+ }
}
void BlockActor::output_fail(const size_t i)
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index b851003..45d3f2a 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -68,7 +68,7 @@ struct InputBufferQueues
ASSERT(not _queues[i].empty());
return
(_queues[i].front().length == _enqueued_bytes[i]) or
- (_queues[i].front().length >= MAX_AUX_BUFF_BYTES);
+ (_queues[i].front().length >= _maximum_bytes[i]);
}
GRAS_FORCE_INLINE void push(const size_t i, const SBuffer &buffer)
@@ -120,6 +120,7 @@ struct InputBufferQueues
BitSet _bitset;
std::vector<size_t> _enqueued_bytes;
std::vector<size_t> _reserve_bytes;
+ std::vector<size_t> _maximum_bytes;
std::vector<boost::circular_buffer<SBuffer> > _queues;
std::vector<size_t> _history_bytes;
std::vector<boost::shared_ptr<BufferQueue> > _aux_queues;
@@ -131,6 +132,7 @@ GRAS_FORCE_INLINE void InputBufferQueues::resize(const size_t size)
_bitset.resize(size);
_enqueued_bytes.resize(size, 0);
_reserve_bytes.resize(size, 1);
+ _maximum_bytes.resize(size, MAX_AUX_BUFF_BYTES);
_queues.resize(size, boost::circular_buffer<SBuffer>(MAX_QUEUE_SIZE));
_history_bytes.resize(size, 0);
_aux_queues.resize(size);
@@ -141,20 +143,20 @@ inline void InputBufferQueues::update_config(
const size_t i,
const size_t hist_bytes,
const size_t reserve_bytes,
- size_t maximum_bytes
+ const size_t maximum_bytes
)
{
//first allocate the aux buffer
- if (maximum_bytes == 0) maximum_bytes = MAX_AUX_BUFF_BYTES;
+ if (maximum_bytes != 0) _maximum_bytes[i] = maximum_bytes;
if (
not _aux_queues[i] or
_aux_queues[i]->empty() or
- _aux_queues[i]->front().get_actual_length() != maximum_bytes
+ _aux_queues[i]->front().get_actual_length() != _maximum_bytes[i]
){
_aux_queues[i] = boost::shared_ptr<BufferQueue>(new BufferQueue());
- _aux_queues[i]->allocate_one(maximum_bytes);
- _aux_queues[i]->allocate_one(maximum_bytes);
- _aux_queues[i]->allocate_one(maximum_bytes);
+ _aux_queues[i]->allocate_one(_maximum_bytes[i]);
+ _aux_queues[i]->allocate_one(_maximum_bytes[i]);
+ _aux_queues[i]->allocate_one(_maximum_bytes[i]);
}
//there is history, so enqueue some initial history