Skip to content

Commit

Permalink
Fix 100% cpu usage on osx bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinandresen committed May 9, 2012
1 parent 8ff1873 commit 8f9123a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util.h
Expand Up @@ -274,8 +274,9 @@ typedef CMutexLock<CWaitableCriticalSection> CWaitableCriticalBlock;
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) \
Expand Down

0 comments on commit 8f9123a

Please sign in to comment.