[project @ 2001-01-25 13:30:31 by simonmar]
authorsimonmar <unknown>
Thu, 25 Jan 2001 13:30:31 +0000 (13:30 +0000)
committersimonmar <unknown>
Thu, 25 Jan 2001 13:30:31 +0000 (13:30 +0000)
Use gettimeofday() to set the target for threadDelay.  The previous
timestamp + ticks hack was wrong, because the virtual timer ticks in
CPU time rather than wall-clock time.

ghc/rts/PrimOps.hc

index 27629ce..efb83c5 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.68 2001/01/16 11:57:06 simonmar Exp $
+ * $Id: PrimOps.hc,v 1.69 2001/01/25 13:30:31 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -1107,7 +1107,7 @@ FN_(delayzh_fast)
 
     ACQUIRE_LOCK(&sched_mutex);
 
-    target = (R1.i / (TICK_MILLISECS*1000)) + timestamp + ticks_since_timestamp;
+    target = (R1.i / (TICK_MILLISECS*1000)) + getourtimeofday();
     CurrentTSO->block_info.target = target;
 
     /* Insert the new thread in the sleeping queue. */