summaryrefslogtreecommitdiff
path: root/rts/RtsStartup.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-08-09 09:24:39 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-08-09 09:24:39 +0000
commit7b1b3279afe25b4e65ee9ebbafc5e9e38a3b888b (patch)
tree51579f1d739bf62f155f7d7ef227ebb796dd82a3 /rts/RtsStartup.c
parent444006bcc30b9fd0db3d2f9430eb21b4f98ba74f (diff)
downloadhaskell-7b1b3279afe25b4e65ee9ebbafc5e9e38a3b888b.tar.gz
make exit() overridable, for use in DLLs
See #753
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r--rts/RtsStartup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 33c742b25a..3fef259126 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -459,6 +459,8 @@ shutdownHaskellAndExit(int n)
static int exit_started=rtsFalse;
#endif
+void (*exitFn)(int) = 0;
+
void
stg_exit(int n)
{
@@ -471,5 +473,7 @@ stg_exit(int n)
IF_PAR_DEBUG(verbose, debugBelch("==-- stg_exit %d on [%x]...", n, mytid));
shutdownParallelSystem(n);
#endif
+ if (exitFn)
+ (*exitFn)(n);
exit(n);
}