Correct spelling mistake: GhcState1HcOpts -> GhcStage1HcOpts
[ghc-hetmet.git] / ghc / rts / Storage.c
index 195f410..974be45 100644 (file)
@@ -51,14 +51,19 @@ ullong total_allocated = 0; /* total memory allocated during run */
 nat n_nurseries         = 0;    /* == RtsFlags.ParFlags.nNodes, convenience */
 step *nurseries         = NULL; /* array of nurseries, >1 only if THREADED_RTS */
 
+#ifdef THREADED_RTS
 /*
  * Storage manager mutex:  protects all the above state from
  * simultaneous access by two STG threads.
  */
-#ifdef THREADED_RTS
 Mutex sm_mutex;
+/*
+ * This mutex is used by atomicModifyMutVar# only
+ */
+Mutex atomic_modify_mutvar_mutex;
 #endif
 
+
 /*
  * Forward references
  */
@@ -127,6 +132,7 @@ initStorage( void )
   
 #if defined(THREADED_RTS)
   initMutex(&sm_mutex);
+  initMutex(&atomic_modify_mutvar_mutex);
 #endif
 
   ACQUIRE_SM_LOCK;
@@ -262,6 +268,12 @@ exitStorage (void)
     stat_exit(calcAllocated());
 }
 
+void
+freeStorage (void)
+{
+    freeAllMBlocks();
+}
+
 /* -----------------------------------------------------------------------------
    CAF management.