summaryrefslogtreecommitdiff
path: root/includes/RtsAPI.h
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2013-11-14 15:54:13 +0000
committerDuncan Coutts <duncan@well-typed.com>2013-11-14 16:06:24 +0000
commita987b8004e83c694e00cdd47cbf43a9588eb47d4 (patch)
tree0e1e6a30e428a128437244c968bbe82d1112d35d /includes/RtsAPI.h
parentad0b943293cce74baf06ea36e1a4d51a3631dfdf (diff)
downloadhaskell-a987b8004e83c694e00cdd47cbf43a9588eb47d4.tar.gz
Improve the shutdownHaskellAndSignal and add fast exit
This is the RTS part of a patch to base's topHandler to handle exiting by a signal. The intended behaviour is that on Unix, throwing ExitFailure (-sig) results in the process terminating with that signal. Previously shutdownHaskellAndSignal was only used for exiting with SIGINT due to the UserInterrupt exception. Improve shutdownHaskellAndSignal to do the signal part more carefully. In particular, it (should) now reliably terminates the process one way or another. Previusly if the signal was blocked, ignored or handled then shutdownHaskellAndSignal would actually return! Also, the topHandler code has two paths a careful shutdown and a "fast exit" where it does not give finalisers a chance to run. We want to support that mode also when we want to exit by signal. So rather than the base code directly calling stg_exit as it did before, we have a fastExit bool paramater for both shutdownHaskellAnd{Exit,Signal}.
Diffstat (limited to 'includes/RtsAPI.h')
-rw-r--r--includes/RtsAPI.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 29c28d8fcc..daae30b821 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -94,14 +94,12 @@ extern void hs_init_with_rtsopts (int *argc, char **argv[]);
extern void hs_init_ghc (int *argc, char **argv[], // program arguments
RtsConfig rts_config); // RTS configuration
-extern void shutdownHaskellAndExit ( int exitCode )
-#if __GNUC__ >= 3
- __attribute__((__noreturn__))
-#endif
- ;
+extern void shutdownHaskellAndExit (int exitCode, int fastExit)
+ GNUC3_ATTRIBUTE(__noreturn__);
#ifndef mingw32_HOST_OS
-extern void shutdownHaskellAndSignal (int sig);
+extern void shutdownHaskellAndSignal (int sig, int fastExit)
+ GNUC3_ATTRIBUTE(__noreturn__);
#endif
extern void getProgArgv ( int *argc, char **argv[] );