diff options
author | Josh Blum | 2012-09-18 11:20:34 -0700 |
---|---|---|
committer | Josh Blum | 2012-09-18 12:24:13 -0700 |
commit | 85e3a7a3a450d0a778d0b730316c7d993d1f5c5f (patch) | |
tree | 4fe816610f1c1a173a157624739e056ac875e4f0 /lib | |
parent | d575f066a8f9e5330645aae5cb8b42c94131471a (diff) | |
download | sandhi-85e3a7a3a450d0a778d0b730316c7d993d1f5c5f.tar.gz sandhi-85e3a7a3a450d0a778d0b730316c7d993d1f5c5f.tar.bz2 sandhi-85e3a7a3a450d0a778d0b730316c7d993d1f5c5f.zip |
added hook for custom output buffer allocator
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); |