summaryrefslogtreecommitdiff
path: root/lib/top_block.cpp
diff options
context:
space:
mode:
authorJosh Blum2013-06-14 01:37:25 -0700
committerJosh Blum2013-06-14 01:37:25 -0700
commit02256e17cc5b9b585340c7ae9a8c97943f5507df (patch)
tree54c6f351a0cad2d843e75f1effe303a6d57608c3 /lib/top_block.cpp
parent24f5e26a878eb2be2773dea337ef43c23d5101f7 (diff)
downloadsandhi-02256e17cc5b9b585340c7ae9a8c97943f5507df.tar.gz
sandhi-02256e17cc5b9b585340c7ae9a8c97943f5507df.tar.bz2
sandhi-02256e17cc5b9b585340c7ae9a8c97943f5507df.zip
gras: tweaks to dot code + dead lock dot print
Diffstat (limited to 'lib/top_block.cpp')
-rw-r--r--lib/top_block.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/top_block.cpp b/lib/top_block.cpp
index cf0fdaa..ee3f0e8 100644
--- a/lib/top_block.cpp
+++ b/lib/top_block.cpp
@@ -98,10 +98,27 @@ void TopBlock::wait(void)
//however, thread group cant be joined twice and this breaks some qa code
//(*this)->thread_group->join_all();
+ boost::system_time check_done_time = boost::get_system_time();
+ bool has_a_done = false;
+
//wait for all blocks to release the token
while (not (*this)->token.unique())
{
wait_thread_yield();
+ if (boost::get_system_time() > check_done_time)
+ {
+ if (has_a_done)
+ {
+ std::cerr << this->query("{\"path\":\"/topology.dot\"}") << std::endl;
+ check_done_time += boost::posix_time::seconds(2);
+ }
+ BOOST_FOREACH(Apology::Worker *w, (*this)->executor->get_workers())
+ {
+ BlockActor *actor = dynamic_cast<BlockActor *>(w->get_actor());
+ if (actor->data->block_state == BLOCK_STATE_DONE) has_a_done = true;
+ }
+ check_done_time += boost::posix_time::seconds(1);
+ }
}
}