[commit: ghc] master: comments (c1ae31f)
Simon Marlow
marlowsd at gmail.com
Thu Feb 7 11:25:32 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c1ae31f65b740e6d65c3553dfbf8d849f2c59b6f
>---------------------------------------------------------------
commit c1ae31f65b740e6d65c3553dfbf8d849f2c59b6f
Author: Simon Marlow <marlowsd at gmail.com>
Date: Thu Feb 7 10:00:09 2013 +0000
comments
>---------------------------------------------------------------
rts/win32/IOManager.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c
index 65f5d4c..0091f23 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;
More information about the ghc-commits
mailing list