X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.c;h=9759b55b85ca6449cd37e1d1a00ec198be6fd443;hb=05a9c035960327b23bad8d8dc501141b183f33b5;hp=c0a9c04d7a73a6cab8b5b7c67f46a2c0b2116e77;hpb=4a7c2629f1dd058ed4c9b6b6b37758b22a9fd6e4;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index c0a9c04..9759b55 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.154 2002/09/17 12:20:15 simonmar Exp $ + * $Id: Schedule.c,v 1.156 2002/09/25 14:46:31 simonmar Exp $ * * (c) The GHC Team, 1998-2000 * @@ -2473,8 +2473,29 @@ GetRoots(evac_fn evac) 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; + } + } + } } /* -----------------------------------------------------------------------------