From 35077ea231cdb78ab91117b2f30c546e75333cf2 Mon Sep 17 00:00:00 2001 From: dnotestein Date: Fri, 6 Dec 2013 00:22:06 -0500 Subject: [PATCH] Set minimum sleep time to 10ms to avoid potential race where the thread wakes back up immediately after being put on sleep queue. This can probably be reduced to about 2ms, but this just seemed safer for now (DanL suggested 10ms). --- src/thread/thread.cpp | 2 +- src/thread/thread_d.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thread/thread.cpp b/src/thread/thread.cpp index 4de4344..0a929eb 100644 --- a/src/thread/thread.cpp +++ b/src/thread/thread.cpp @@ -178,7 +178,7 @@ namespace fc { void thread::sleep_until( const time_point& tp ) { //ilog( "sleep until ${tp} wait: ${delta}", ("tp",tp)("delta",(tp-fc::time_point::now()).count()) ); - if( tp <= (time_point::now()+fc::microseconds(500)) ) + if( tp <= (time_point::now()+fc::microseconds(10000)) ) { this->yield(true); } diff --git a/src/thread/thread_d.hpp b/src/thread/thread_d.hpp index b482b2e..8f5237f 100644 --- a/src/thread/thread_d.hpp +++ b/src/thread/thread_d.hpp @@ -447,7 +447,7 @@ namespace fc { void yield_until( const time_point& tp, bool reschedule ) { check_fiber_exceptions(); - if( tp <= (time_point::now()+fc::microseconds(500)) ) + if( tp <= (time_point::now()+fc::microseconds(10000)) ) { return; }