changeset 2447:6ddd0dc10af0 draft

Fix 100% cpu usage on osx bug
author Gavin Andresen <gavinandresen@gmail.com>
date Wed, 09 May 2012 18:24:34 -0400
parents 27f7588399b7
children 76a3c51e236c
files src/util.h
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.h
+++ b/src/util.h
@@ -274,8 +274,9 @@
 typedef boost::interprocess::interprocess_condition CConditionVariable;
 
 /** Wait for a given condition inside a WAITABLE_CRITICAL_BLOCK */
+/** Sleep(1) is to workaround a 100% cpu-usage bug on OSX **/
 #define WAIT(name,condition) \
-   do { while(!(condition)) { (name).wait(waitablecriticalblock.GetLock()); } } while(0)
+    do { while(!(condition)) { (name).wait(waitablecriticalblock.GetLock()); Sleep(1);} } while(0)
 
 /** Notify waiting threads that a condition may hold now */
 #define NOTIFY(name) \