Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Thread.sleep for windows: for non-zero timeout, sleep at least 1ms
Browse files Browse the repository at this point in the history
  • Loading branch information
rainers committed Aug 24, 2013
1 parent 742afae commit 9f02de4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/thread.d
Expand Up @@ -960,6 +960,10 @@ class Thread
{
auto maxSleepMillis = dur!("msecs")( uint.max - 1 );

// avoid a non-zero time to be round down to 0
if( val > dur!"msecs"( 0 ) && val < dur!"msecs"( 1 ) )
val = dur!"msecs"( 1 );

// NOTE: In instances where all other threads in the process have a
// lower priority than the current thread, the current thread
// will not yield with a sleep time of zero. However, unlike
Expand Down

0 comments on commit 9f02de4

Please sign in to comment.