diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block_allocator.cpp | 32 | ||||
-rw-r--r-- | lib/block_handlers.cpp | 2 |
2 files changed, 22 insertions, 12 deletions
diff --git a/lib/block_allocator.cpp b/lib/block_allocator.cpp index 708b35b..24369c7 100644 --- a/lib/block_allocator.cpp +++ b/lib/block_allocator.cpp @@ -86,17 +86,27 @@ void ElementImpl::handle_allocation(const tsbe::TaskInterface &task_iface) ); SBufferDeleter deleter = boost::bind(&ElementImpl::buffer_returner, this, i, _1); - this->output_buffer_tokens[i] = SBufferToken(new SBufferDeleter(deleter)); - for (size_t j = 0; j < THIS_MANY_BUFFERS; j++) - { - SBufferConfig config; - config.memory = NULL; - config.length = bytes; - config.affinity = this->buffer_affinity; - config.token = this->output_buffer_tokens[i]; - SBuffer buff(config); - //buffer derefs here and the token messages it back to the block - } + this->output_buffer_tokens[i] = block_ptr->output_buffer_allocator( + i, SBufferToken(new SBufferDeleter(deleter)), bytes + ); + } +} + +SBufferToken Block::output_buffer_allocator( + const size_t which_output, + const SBufferToken &token, + const size_t recommend_length +){ + for (size_t j = 0; j < THIS_MANY_BUFFERS; j++) + { + SBufferConfig config; + config.memory = NULL; + config.length = recommend_length; + config.affinity = (*this)->buffer_affinity; + config.token = token; + SBuffer buff(config); + //buffer derefs here and the token messages it back to the block } + return token; } diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp index d61a7e2..684b6fa 100644 --- a/lib/block_handlers.cpp +++ b/lib/block_handlers.cpp @@ -93,7 +93,7 @@ void ElementImpl::handle_block_msg( //tell the upstream about the input requirements BufferHintMessage message; message.history_bytes = this->input_history_items[i]*this->input_items_sizes[i]; - message.reserve_bytes = input_multiple_items[i]; + message.reserve_bytes = this->input_multiple_items[i]; message.token = this->input_tokens[i]; task_iface.post_upstream(i, message); |