diff options
author | Josh Blum | 2012-09-22 17:49:52 -0400 |
---|---|---|
committer | Josh Blum | 2012-09-22 17:49:52 -0400 |
commit | a76963ab6fdde4bf793ecb38f95fa6255647288a (patch) | |
tree | 9dc44a50a830f7d3d76ea11f7cac9ae4aef558b0 /lib/top_block.cpp | |
parent | 89de2759ba95682f51865dd06b7509e48969dc96 (diff) | |
download | sandhi-a76963ab6fdde4bf793ecb38f95fa6255647288a.tar.gz sandhi-a76963ab6fdde4bf793ecb38f95fa6255647288a.tar.bz2 sandhi-a76963ab6fdde4bf793ecb38f95fa6255647288a.zip |
threading related tweaks for happy qa code
Diffstat (limited to 'lib/top_block.cpp')
-rw-r--r-- | lib/top_block.cpp | 14 |
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(); |