Commit 2ffcdfad authored by Simon Marlow's avatar Simon Marlow Committed by Ben Gamari
Browse files

Fatal if we try to reinitialize the RTS

This isn't supported, and fatalling with an error is better than
segfaulting later.

Test Plan: validate

Reviewers: JonCoens, austin, erikd, niteria, bgamari

Reviewed By: niteria, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D3020
parent 4e63e859
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
// Count of how many outstanding hs_init()s there have been. // Count of how many outstanding hs_init()s there have been.
static int hs_init_count = 0; static int hs_init_count = 0;
static bool rts_shutdown = false;
static void flushStdHandles(void); static void flushStdHandles(void);
...@@ -145,6 +146,10 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) ...@@ -145,6 +146,10 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
// second and subsequent inits are ignored // second and subsequent inits are ignored
return; return;
} }
if (rts_shutdown) {
errorBelch("hs_init_ghc: reinitializing the RTS after shutdown is not currently supported");
stg_exit(1);
}
setlocale(LC_CTYPE,""); setlocale(LC_CTYPE,"");
...@@ -338,6 +343,7 @@ hs_exit_(bool wait_foreign) ...@@ -338,6 +343,7 @@ hs_exit_(bool wait_foreign)
// ignore until it's the last one // ignore until it's the last one
return; return;
} }
rts_shutdown = true;
/* start timing the shutdown */ /* start timing the shutdown */
stat_startExit(); stat_startExit();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment