X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.c;h=17c7e74b598d855f6fb7dc5b0be0fce9c2974aab;hb=d482ad51c9051d6eb9fbcafd90362949db29f374;hp=56426a54debf454498347a8d35ff1f21693a1109;hpb=bfc81d864fe982c197fdbd002fd5b02334cc049c;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 56426a5..17c7e74 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.153 2002/08/28 13:02:51 simonmar Exp $ + * $Id: Schedule.c,v 1.157 2002/10/22 11:01:19 simonmar Exp $ * * (c) The GHC Team, 1998-2000 * @@ -1657,10 +1657,11 @@ static void unblockThread(StgTSO *tso); * instances of Eq/Ord for ThreadIds. * ------------------------------------------------------------------------ */ -int cmp_thread(const StgTSO *tso1, const StgTSO *tso2) +int +cmp_thread(StgPtr tso1, StgPtr tso2) { - StgThreadID id1 = tso1->id; - StgThreadID id2 = tso2->id; + StgThreadID id1 = ((StgTSO *)tso1)->id; + StgThreadID id2 = ((StgTSO *)tso2)->id; if (id1 < id2) return (-1); if (id1 > id2) return 1; @@ -1672,13 +1673,15 @@ int cmp_thread(const StgTSO *tso1, const StgTSO *tso2) * * This is used in the implementation of Show for ThreadIds. * ------------------------------------------------------------------------ */ -int rts_getThreadId(const StgTSO *tso) +int +rts_getThreadId(StgPtr tso) { - return tso->id; + return ((StgTSO *)tso)->id; } #ifdef DEBUG -void labelThread(StgTSO *tso, char *label) +void +labelThread(StgPtr tso, char *label) { int len; void *buf; @@ -2472,6 +2475,30 @@ GetRoots(evac_fn evac) #if defined(PAR) || defined(GRAN) markSparkQueue(evac); #endif + +#ifndef mingw32_TARGET_OS + // mark the signal handlers (signals should be already blocked) + markSignalHandlers(evac); +#endif + + // main threads which have completed need to be retained until they + // are dealt with in the main scheduler loop. They won't be + // retained any other way: the GC will drop them from the + // all_threads list, so we have to be careful to treat them as roots + // here. + { + StgMainThread *m; + for (m = main_threads; m != NULL; m = m->link) { + switch (m->tso->what_next) { + case ThreadComplete: + case ThreadKilled: + evac((StgClosure **)&m->tso); + break; + default: + break; + } + } + } } /* -----------------------------------------------------------------------------