/* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.152 2002/08/16 13:29:07 simonmar Exp $
+ * $Id: Schedule.c,v 1.156 2002/09/25 14:46:31 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
#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;
+ }
+ }
+ }
}
/* -----------------------------------------------------------------------------
/* Remove it from any blocking queues */
unblockThread(tso);
- IF_DEBUG(scheduler, sched_belch("raising exception in thread %ld.", tso->id));
/* The stack freezing code assumes there's a closure pointer on
* the top of the stack. This isn't always the case with compiled
* code, so we have to push a dummy closure on the top which just