diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-08-09 09:24:39 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-08-09 09:24:39 +0000 |
commit | 7b1b3279afe25b4e65ee9ebbafc5e9e38a3b888b (patch) | |
tree | 51579f1d739bf62f155f7d7ef227ebb796dd82a3 /rts | |
parent | 444006bcc30b9fd0db3d2f9430eb21b4f98ba74f (diff) | |
download | haskell-7b1b3279afe25b4e65ee9ebbafc5e9e38a3b888b.tar.gz |
make exit() overridable, for use in DLLs
See #753
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RtsStartup.c | 4 | ||||
-rw-r--r-- | rts/Storage.c | 2 |
2 files changed, 5 insertions, 1 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); } diff --git a/rts/Storage.c b/rts/Storage.c index d3b059768b..3594f7197f 100644 --- a/rts/Storage.c +++ b/rts/Storage.c @@ -127,7 +127,7 @@ initStorage( void ) RtsFlags.GcFlags.minAllocAreaSize > RtsFlags.GcFlags.maxHeapSize) { errorBelch("maximum heap size (-M) is smaller than minimum alloc area size (-A)"); - exit(1); + RtsFlags.GcFlags.minAllocAreaSize = RtsFlags.GcFlags.maxHeapSize; } initBlockAllocator(); |