From a0b380bb30e37ab75eb42ff3f7e9a9bc60291496 Mon Sep 17 00:00:00 2001
From: rrt <unknown>
Date: Mon, 3 Apr 2000 15:24:21 +0000
Subject: [PATCH] [project @ 2000-04-03 15:24:21 by rrt] Stopped
 getourtimeofday() being called under mingwin. MBlock.c: changed one instance
 of 128 * 1024 * 1024 into SIZE_RESERVED_POOL and added a TODO comment (bug in
 is_heap_alloced(), which won't work if more than one megablock is ever
 allocated).

---
 ghc/rts/Evaluator.c | 6 +++---
 ghc/rts/MBlock.c    | 5 +++--
 ghc/rts/Schedule.c  | 4 ++--
 ghc/rts/Select.c    | 6 +++---
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/ghc/rts/Evaluator.c b/ghc/rts/Evaluator.c
index 4aa5dcf57a05..b7906f7589ec 100644
--- a/ghc/rts/Evaluator.c
+++ b/ghc/rts/Evaluator.c
@@ -5,8 +5,8 @@
  * Copyright (c) 1994-1998.
  *
  * $RCSfile: Evaluator.c,v $
- * $Revision: 1.45 $
- * $Date: 2000/03/20 15:49:56 $
+ * $Revision: 1.46 $
+ * $Date: 2000/04/03 15:24:21 $
  * ---------------------------------------------------------------------------*/
 
 #include "Rts.h"
@@ -530,7 +530,7 @@ StgThreadReturnCode enter( Capability* cap, StgClosure* obj0 )
 	   cap->rCurrentTSO->why_blocked = BlockedOnDelay;
 	   ACQUIRE_LOCK(&sched_mutex);
 	   
-#if defined(HAVE_SETITIMER)
+#if defined(HAVE_SETITIMER) || defined(mingw32_TARGET_OS)
 	   cap->rCurrentTSO->block_info.delay 
 	     = hugsBlock.delay + ticks_since_select;
 #else
diff --git a/ghc/rts/MBlock.c b/ghc/rts/MBlock.c
index 5054760df118..c0a619fbad87 100644
--- a/ghc/rts/MBlock.c
+++ b/ghc/rts/MBlock.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: MBlock.c,v 1.14 2000/01/22 12:06:43 simonmar Exp $
+ * $Id: MBlock.c,v 1.15 2000/04/03 15:24:21 rrt Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -152,11 +152,12 @@ char* base_non_committed = (char*)0;
 #define SIZE_RESERVED_POOL  ( 128 * 1024 * 1024 )
 
 /* This predicate should be inlined, really. */
+/* TODO: this only works for a single chunk */
 int
 is_heap_alloced(const void* x)
 {
   return (((char*)(x) >= base_non_committed) && 
-          ((char*)(x) <= (base_non_committed + 128 * 1024 * 1024)));
+          ((char*)(x) <= (base_non_committed + SIZE_RESERVED_POOL)));
 }
 
 void *
diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c
index c0de8b0b0d72..413bfa88a9ec 100644
--- a/ghc/rts/Schedule.c
+++ b/ghc/rts/Schedule.c
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.60 2000/03/31 03:09:36 hwloidl Exp $
+ * $Id: Schedule.c,v 1.61 2000/04/03 15:24:21 rrt Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -2893,7 +2893,7 @@ printThreadBlockage(StgTSO *tso)
     fprintf(stderr,"blocked on write to fd %d", tso->block_info.fd);
     break;
   case BlockedOnDelay:
-#if defined(HAVE_SETITIMER)
+#if defined(HAVE_SETITIMER) || defined(mingw32_TARGET_OS)
     fprintf(stderr,"blocked on delay of %d ms", tso->block_info.delay);
 #else
     fprintf(stderr,"blocked on delay of %d ms", 
diff --git a/ghc/rts/Select.c b/ghc/rts/Select.c
index 49c84ff6bf0e..79b21ba487bc 100644
--- a/ghc/rts/Select.c
+++ b/ghc/rts/Select.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Select.c,v 1.11 2000/03/23 12:02:38 simonmar Exp $
+ * $Id: Select.c,v 1.12 2000/04/03 15:24:21 rrt Exp $
  *
  * (c) The GHC Team 1995-1999
  *
@@ -107,7 +107,7 @@ awaitEvent(rtsBool wait)
 	case BlockedOnDelay:
 	  {
 	    int candidate; /* signed int is intentional */
-#if defined(HAVE_SETITIMER)
+#if defined(HAVE_SETITIMER) || defined(mingw32_TARGET_OS)
 	    candidate = tso->block_info.delay;
 #else
 	    candidate = tso->block_info.target - getourtimeofday();
@@ -222,7 +222,7 @@ awaitEvent(rtsBool wait)
 	
 	case BlockedOnDelay:
 	  {
-#if defined(HAVE_SETITIMER)
+#if defined(HAVE_SETITIMER) || defined(mingw32_TARGET_OS)
 	    if (tso->block_info.delay > delta) {
 	      tso->block_info.delay -= delta;
 	      ready = 0;
-- 
GitLab