Free thread local storage on shutdown
[ghc-hetmet.git] / rts / posix / OSThreads.c
index b30d085..6b6fa5c 100644 (file)
@@ -93,6 +93,14 @@ osThreadId()
   return pthread_self();
 }
 
+rtsBool
+osThreadIsAlive(OSThreadId id STG_UNUSED)
+{
+    // no good way to implement this on POSIX, AFAICT.  Returning true
+    // is safe.
+    return rtsTrue;
+}
+
 void
 initMutex(Mutex* pMut)
 {
@@ -140,6 +148,15 @@ setThreadLocalVar (ThreadLocalKey *key, void *value)
     }
 }
 
+void
+freeThreadLocalKey (ThreadLocalKey *key)
+{
+    int r;
+    if ((r = pthread_key_delete(key)) != 0) {
+       barf("freeThreadLocalKey: %s", strerror(r));
+    }
+}
+
 static void *
 forkOS_createThreadWrapper ( void * entry )
 {