diff options
author | Josh Blum | 2013-09-12 23:06:12 -0700 |
---|---|---|
committer | Josh Blum | 2013-09-12 23:06:12 -0700 |
commit | 1494e66b4b448132030c233ef75dd9210b90e9ef (patch) | |
tree | 7420af1cff1b0d31ef24fb0d366d8e6f198c4c0d /lib/block.cpp | |
parent | f9c0d4c2e39aa28cc501ceb6479afc32f7849b11 (diff) | |
download | sandhi-1494e66b4b448132030c233ef75dd9210b90e9ef.tar.gz sandhi-1494e66b4b448132030c233ef75dd9210b90e9ef.tar.bz2 sandhi-1494e66b4b448132030c233ef75dd9210b90e9ef.zip |
gras: added thread pool to global config
Diffstat (limited to 'lib/block.cpp')
-rw-r--r-- | lib/block.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/block.cpp b/lib/block.cpp index 406e33c..51b661f 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -144,6 +144,18 @@ const OutputPortConfig &Block::output_config(const size_t which_output) const void Block::commit_config(void) { Theron::Actor &actor = *((*this)->block_actor); + + //handle thread pool migration + const ThreadPool &thread_pool = this->global_config().thread_pool; + if (thread_pool and thread_pool != (*this)->block_actor->thread_pool) + { + boost::shared_ptr<BlockActor> old_actor = (*this)->block_actor; + (*this)->block_actor.reset(BlockActor::make(thread_pool)); + (*this)->setup_actor(); + wait_actor_idle((*this)->repr, *old_actor); + } + + //update messages for in and out ports for (size_t i = 0; i < (*this)->worker->get_num_inputs(); i++) { InputUpdateMessage message; @@ -156,7 +168,6 @@ void Block::commit_config(void) message.index = i; actor.GetFramework().Send(message, Theron::Address::Null(), actor.GetAddress()); } - } void Block::notify_active(void) |