summaryrefslogtreecommitdiff
path: root/rts/win32
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-02-07 10:00:09 +0000
committerSimon Marlow <marlowsd@gmail.com>2013-02-07 10:00:09 +0000
commitc1ae31f65b740e6d65c3553dfbf8d849f2c59b6f (patch)
tree3011497433881dc1e76045014e6004b0e29817cf /rts/win32
parent2f7044dee40ba6eadc1877ec49c30e1695d63fe4 (diff)
downloadhaskell-c1ae31f65b740e6d65c3553dfbf8d849f2c59b6f.tar.gz
comments
Diffstat (limited to 'rts/win32')
-rw-r--r--rts/win32/IOManager.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c
index 65f5d4cf99..0091f23b3c 100644
--- a/rts/win32/IOManager.c
+++ b/rts/win32/IOManager.c
@@ -199,7 +199,17 @@ IOWorkerProc(PVOID param)
/* Approximate implementation of threadDelay;
*
* Note: Sleep() is in milliseconds, not micros.
- */
+ *
+ * MSDN says of Sleep:
+ * If dwMilliseconds is greater than one tick
+ * but less than two, the wait can be anywhere
+ * between one and two ticks, and so on.
+ *
+ * so we need to add (milliseconds-per-tick - 1)
+ * to the amount of time we sleep for.
+ *
+ * test ThreadDelay001 fails if we get this wrong.
+ */
Sleep(((work->workData.delayData.usecs + 999) / 1000) + iom->sleepResolution - 1);
len = work->workData.delayData.usecs;
complData = NULL;