[project @ 2003-09-12 16:26:05 by sof]
[ghc-hetmet.git] / ghc / rts / ThreadLabels.c
index fda40c3..2856ae7 100644 (file)
@@ -1,14 +1,26 @@
+/* -----------------------------------------------------------------------------
+ * ThreadLabels.c
+ *
+ * (c) The GHC Team 2002-2003
+ *
+ * Table of thread labels.
+ *
+ * ---------------------------------------------------------------------------*/
 
 #include "PosixSource.h"
 #include "ThreadLabels.h"
+#include "RtsUtils.h"
 
-HashTable * threadLabels = NULL;
+#include <stdlib.h>
+
+static HashTable * threadLabels = NULL;
 
 void
 initThreadLabelTable(void)
 {
-  ASSERT(threadLabels == NULL);
-  threadLabels = allocHashTable();
+  if (threadLabels == NULL) {
+    threadLabels = allocHashTable();
+  }
 }
 
 void
@@ -30,6 +42,6 @@ removeThreadLabel(StgWord key)
   void * old = NULL;
   if ((old = lookupHashTable(threadLabels,key))) {
     removeHashTable(threadLabels,key,old);
-    free(old);
+    stgFree(old);
   }  
 }