From 6a268d8669c50288f33d5bccd468522a8d56073a Mon Sep 17 00:00:00 2001 From: sof Date: Fri, 26 Apr 2002 22:35:55 +0000 Subject: [PATCH] [project @ 2002-04-26 22:35:54 by sof] When the OS thread is all out of work, shut down in a gentler manner by calling shutdownHaskell() rather than shutdownHaskellAndExit(). Give up the sched_mutex lock also. --- ghc/rts/RtsStartup.c | 5 ++--- ghc/rts/Schedule.c | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ghc/rts/RtsStartup.c b/ghc/rts/RtsStartup.c index 4066f48..36821d0 100644 --- a/ghc/rts/RtsStartup.c +++ b/ghc/rts/RtsStartup.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsStartup.c,v 1.61 2002/02/04 20:25:39 sof Exp $ + * $Id: RtsStartup.c,v 1.62 2002/04/26 22:35:55 sof Exp $ * * (c) The GHC Team, 1998-2000 * @@ -272,6 +272,7 @@ shutdownHaskell(void) { if (!rts_has_started_up) return; + rts_has_started_up=0; /* start timing the shutdown */ stat_startExit(); @@ -338,8 +339,6 @@ shutdownHaskell(void) #if defined(TICKY_TICKY) if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo(); #endif - - rts_has_started_up=0; } /* diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 9d816b0..64c983e 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.140 2002/04/23 14:20:18 sof Exp $ + * $Id: Schedule.c,v 1.141 2002/04/26 22:35:54 sof Exp $ * * (c) The GHC Team, 1998-2000 * @@ -685,7 +685,9 @@ schedule( void ) /* ToDo: revisit conditions (and mechanism) for shutting down a multi-threaded world */ IF_DEBUG(scheduler, sched_belch("all done, i think...shutting down.")); - shutdownHaskellAndExit(0); + RELEASE_LOCK(&sched_mutex); + shutdownHaskell(); + return; #endif } not_deadlocked: @@ -2195,7 +2197,6 @@ waitThread_(StgTSO *tso, } else # endif { - IF_DEBUG(scheduler, sched_belch("sfoo")); do { waitCondition(&m->wakeup, &sched_mutex); } while (m->stat == NoStatus); -- 1.7.10.4