summaryrefslogtreecommitdiff
path: root/lib/top_block.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/top_block.cpp')
-rw-r--r--lib/top_block.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/top_block.cpp b/lib/top_block.cpp
index bea7371..fdabad1 100644
--- a/lib/top_block.cpp
+++ b/lib/top_block.cpp
@@ -106,16 +106,24 @@ void TopBlock::run(void)
this->wait();
}
+GRAS_FORCE_INLINE void wait_thread_yield(void)
+{
+ //boost::this_thread::yield();
+ boost::this_thread::sleep(boost::posix_time::milliseconds(1));
+}
+
void TopBlock::wait(void)
{
//We do not need to join "special" threads;
//the token mechainism will do just fine.
- (*this)->thread_group->join_all();
+ //FIXME it might be nice to uncomment this for some nice quiet wait(),
+ //however, thread group cant be joined twice and this breaks some qa code
+ //(*this)->thread_group->join_all();
//wait for all blocks to release the token
while (not (*this)->token.unique())
{
- boost::this_thread::yield();
+ wait_thread_yield();
}
}
@@ -127,7 +135,7 @@ bool TopBlock::wait(const double timeout)
//wait for all blocks to release the token
while (not (*this)->token.unique() or boost::get_system_time() < exit_time)
{
- boost::this_thread::yield();
+ wait_thread_yield();
}
return (*this)->token.unique();