makefile tweak
[ghc-hetmet.git] / rts / Stable.c
index a2c47d7..97796b8 100644 (file)
@@ -6,9 +6,6 @@
  *
  * ---------------------------------------------------------------------------*/
 
-// Make static versions of inline functions in Stable.h:
-#define RTS_STABLE_C
-
 #include "PosixSource.h"
 #include "Rts.h"
 #include "Hash.h"
@@ -319,6 +316,23 @@ enlargeStablePtrTable(void)
 }
 
 /* -----------------------------------------------------------------------------
+ * We must lock the StablePtr table during GC, to prevent simultaneous
+ * calls to freeStablePtr().
+ * -------------------------------------------------------------------------- */
+
+void
+stablePtrPreGC(void)
+{
+    ACQUIRE_LOCK(&stable_mutex);
+}
+
+void
+stablePtrPostGC(void)
+{
+    RELEASE_LOCK(&stable_mutex);
+}
+
+/* -----------------------------------------------------------------------------
  * Treat stable pointers as roots for the garbage collector.
  *
  * A stable pointer is any stable name entry with a ref > 0.  We'll