[commit: ghc] master: Fatal if we try to reinitialize the RTS (2ffcdfa)

git at git.haskell.org git at git.haskell.org
Thu Jan 26 23:44:54 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2ffcdfadaa53c9bc4b24606dc2e28a356a60d21e/ghc

>---------------------------------------------------------------

commit 2ffcdfadaa53c9bc4b24606dc2e28a356a60d21e
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Thu Jan 26 18:13:43 2017 -0500

    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


>---------------------------------------------------------------

2ffcdfadaa53c9bc4b24606dc2e28a356a60d21e
 rts/RtsStartup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 98c1dd2..9ec8af8 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -62,6 +62,7 @@
 
 // Count of how many outstanding hs_init()s there have been.
 static int hs_init_count = 0;
+static bool rts_shutdown = false;
 
 static void flushStdHandles(void);
 
@@ -145,6 +146,10 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
         // second and subsequent inits are ignored
         return;
     }
+    if (rts_shutdown) {
+        errorBelch("hs_init_ghc: reinitializing the RTS after shutdown is not currently supported");
+        stg_exit(1);
+    }
 
     setlocale(LC_CTYPE,"");
 
@@ -338,6 +343,7 @@ hs_exit_(bool wait_foreign)
         // ignore until it's the last one
         return;
     }
+    rts_shutdown = true;
 
     /* start timing the shutdown */
     stat_startExit();



More information about the ghc-commits mailing list