From f84bb9a2e577c9c1be83a806a4cf70fccfb45b54 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 29 Jan 2003 10:28:56 +0000 Subject: [PATCH] [project @ 2003-01-29 10:28:56 by simonmar] Multi-init protection. Multiple inits now don't crash, but they still don't do anything sensible because the finalizers have been run during the first hs_exit(). --- ghc/rts/Storage.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ghc/rts/Storage.c b/ghc/rts/Storage.c index 6f6fe70..a1bfc5e 100644 --- a/ghc/rts/Storage.c +++ b/ghc/rts/Storage.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Storage.c,v 1.74 2003/01/23 12:13:12 simonmar Exp $ + * $Id: Storage.c,v 1.75 2003/01/29 10:28:56 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -39,10 +39,10 @@ nat alloc_blocks_lim; /* approximate limit on alloc_blocks */ StgPtr alloc_Hp = NULL; /* next free byte in small_alloc_list */ StgPtr alloc_HpLim = NULL; /* end of block at small_alloc_list */ -generation *generations; /* all the generations */ -generation *g0; /* generation 0, for convenience */ -generation *oldest_gen; /* oldest generation, for convenience */ -step *g0s0; /* generation 0, step 0, for convenience */ +generation *generations = NULL; /* all the generations */ +generation *g0 = NULL; /* generation 0, for convenience */ +generation *oldest_gen = NULL; /* oldest generation, for convenience */ +step *g0s0 = NULL; /* generation 0, step 0, for convenience */ lnat total_allocated = 0; /* total memory allocated during run */ @@ -68,6 +68,11 @@ initStorage( void ) step *stp; generation *gen; + if (generations != NULL) { + // multi-init protection + return; + } + /* Sanity check to make sure the LOOKS_LIKE_ macros appear to be * doing something reasonable. */ -- 1.7.10.4