From c13c43a111e825bb87a465ccbb9533f302beaa09 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 10 Sep 1999 11:11:52 +0000 Subject: [PATCH] [project @ 1999-09-10 11:11:51 by simonmar] Fix run queue corruption bug, introduced in recent threadWait commit. This fixes the "memo002 goes off into outer space" bug. --- ghc/rts/Schedule.c | 3 ++- ghc/rts/Schedule.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 8450d97..30381a4 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.24 1999/08/25 16:11:51 simonmar Exp $ + * $Id: Schedule.c,v 1.25 1999/09/10 11:11:51 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -654,6 +654,7 @@ StgTSO *unblockOne(StgTSO *tso) ASSERT(tso->why_blocked != NotBlocked); tso->why_blocked = NotBlocked; next = tso->link; + tso->link = END_TSO_QUEUE; PUSH_ON_RUN_QUEUE(tso); IF_DEBUG(scheduler,belch("Waking up thread %ld", tso->id)); return next; diff --git a/ghc/rts/Schedule.h b/ghc/rts/Schedule.h index 4a2cac0..3bc46d5 100644 --- a/ghc/rts/Schedule.h +++ b/ghc/rts/Schedule.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.h,v 1.6 1999/08/25 16:11:51 simonmar Exp $ + * $Id: Schedule.h,v 1.7 1999/09/10 11:11:52 simonmar Exp $ * * (c) The GHC Team 1998-1999 * @@ -43,6 +43,9 @@ extern StgTSO *MainTSO; /* temporary hack */ #endif #define END_TSO_QUEUE ((StgTSO *)(void*)&END_TSO_QUEUE_closure) +/* Add a thread to the end of the run queue. + * NOTE: tso->link should be END_TSO_QUEUE before calling this macro. + */ #define PUSH_ON_RUN_QUEUE(tso) \ if (run_queue_hd == END_TSO_QUEUE) { \ run_queue_hd = tso; \ -- 1.7.10.4