ANSI-ise a function declaration
[ghc-hetmet.git] / rts / posix / Signals.c
index abbb97a..fcfa1f1 100644 (file)
@@ -164,22 +164,6 @@ StgPtr *next_pending_handler = pending_handler_buf;
 #endif /* THREADED_RTS */
 
 /* -----------------------------------------------------------------------------
- * SIGCONT handler
- *
- * It seems that shells tend to put stdin back into blocking mode
- * following a suspend/resume of the process.  Here we arrange to put
- * it back into non-blocking mode.  We don't do anything to
- * stdout/stderr because these handles don't get put into non-blocking
- * mode at all - see the comments on stdout/stderr in PrelHandle.hsc.
- * -------------------------------------------------------------------------- */
-
-static void
-cont_handler(int sig STG_UNUSED)
-{
-    setNonBlockingFd(0);
-}
-
-/* -----------------------------------------------------------------------------
  * Low-level signal handler
  *
  * Places the requested handler on a stack of pending handlers to be
@@ -249,11 +233,6 @@ generic_handler(int sig)
     sigaddset(&signals, sig);
     sigprocmask(SIG_UNBLOCK, &signals, NULL);
 
-    // *always* do the SIGCONT handler, even if the user overrides it.
-    if (sig == SIGCONT) {
-       cont_handler(sig);
-    }
-
     context_switch = 1;
 }
 
@@ -413,19 +392,19 @@ startSignalHandlers(Capability *cap)
 
 #if !defined(THREADED_RTS)
 void
-markSignalHandlers (evac_fn evac)
+markSignalHandlers (evac_fn evac, void *user)
 {
     StgPtr *p;
 
     p = next_pending_handler;
     while (p != pending_handler_buf) {
        p--;
-       evac((StgClosure **)p);
+       evac(user, (StgClosure **)p);
     }
 }
 #else
 void
-markSignalHandlers (evac_fn evac STG_UNUSED)
+markSignalHandlers (evac_fn evac STG_UNUSED, void *user STG_UNUSED)
 {
 }
 #endif
@@ -450,24 +429,9 @@ stg_sig_install(StgInt sig STG_UNUSED,
  * We like to shutdown nicely after receiving a SIGINT, write out the
  * stats, write profiling info, close open files and flush buffers etc.
  * -------------------------------------------------------------------------- */
-#ifdef SMP
-pthread_t startup_guy;
-#endif
-
 static void
 shutdown_handler(int sig STG_UNUSED)
 {
-#ifdef SMP
-    // if I'm a worker thread, send this signal to the guy who
-    // originally called startupHaskell().  Since we're handling
-    // the signal, it won't be a "send to all threads" type of signal
-    // (according to the POSIX threads spec).
-    if (pthread_self() != startup_guy) {
-       pthread_kill(startup_guy, sig);
-       return;
-    }
-#endif
-
     // If we're already trying to interrupt the RTS, terminate with
     // extreme prejudice.  So the first ^C tries to exit the program
     // cleanly, and the second one just kills it.
@@ -494,14 +458,10 @@ shutdown_handler(int sig STG_UNUSED)
  * doesn't seem to do so.
  * -------------------------------------------------------------------------- */
 void
-initDefaultHandlers()
+initDefaultHandlers(void)
 {
     struct sigaction action,oact;
 
-#ifdef SMP
-    startup_guy = pthread_self();
-#endif
-
     // install the SIGINT handler
     action.sa_handler = shutdown_handler;
     sigemptyset(&action.sa_mask);
@@ -514,14 +474,6 @@ initDefaultHandlers()
     siginterrupt(SIGINT, 1);   // isn't this the default? --SDM
 #endif
 
-    // install the SIGCONT handler
-    action.sa_handler = cont_handler;
-    sigemptyset(&action.sa_mask);
-    action.sa_flags = 0;
-    if (sigaction(SIGCONT, &action, &oact) != 0) {
-       sysErrorBelch("warning: failed to install SIGCONT handler");
-    }
-
     // install the SIGFPE handler
 
     // In addition to handling SIGINT, also handle SIGFPE by ignoring it.