From c4729619f98b8aee2ea5555638f939518b7edd00 Mon Sep 17 00:00:00 2001
From: simonmar <unknown>
Date: Mon, 4 Oct 1999 16:13:18 +0000
Subject: [PATCH] [project @ 1999-10-04 16:13:18 by simonmar] allow raising
 exceptions in threads blocked on I/O or time delays

---
 ghc/rts/Schedule.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c
index 30381a4eaa84..8f3f7e323c46 100644
--- a/ghc/rts/Schedule.c
+++ b/ghc/rts/Schedule.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.25 1999/09/10 11:11:51 simonmar Exp $
+ * $Id: Schedule.c,v 1.26 1999/10/04 16:13:18 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -732,11 +732,23 @@ unblockThread(StgTSO *tso)
       barf("unblockThread (BLACKHOLE): TSO not found");
     }
 
+  case BlockedOnDelay:
   case BlockedOnRead:
   case BlockedOnWrite:
-  case BlockedOnDelay:
-    /* ToDo */
-    barf("unblockThread {read,write,delay}");
+    {
+      last = &blocked_queue_hd;
+      for (t = blocked_queue_hd; t != END_TSO_QUEUE; 
+	   last = &t->link, t = t->link) {
+	if (t == tso) {
+	  *last = tso->link;
+	  if (blocked_queue_tl == t) {
+	    blocked_queue_tl = tso->link;
+	  }
+	  goto done;
+	}
+      }
+      barf("unblockThread (I/O): TSO not found");
+    }
 
   default:
     barf("unblockThread");
-- 
GitLab