[project @ 2003-09-19 18:56:00 by wolfgang]
authorwolfgang <unknown>
Fri, 19 Sep 2003 18:56:00 +0000 (18:56 +0000)
committerwolfgang <unknown>
Fri, 19 Sep 2003 18:56:00 +0000 (18:56 +0000)
POSIX threads should be pthread_detach-ed after they are created.
Otherwise they'll stick around waiting for a pthread_join.

(This wasn't really a problem because our worker threads never exit anyway).

ghc/rts/OSThreads.c

index 01e0a25..739090d 100644 (file)
@@ -78,7 +78,10 @@ startProcWrapper(void* pProc)
 int
 createOSThread ( OSThreadId* pId, void (*startProc)(void))
 {
-  return pthread_create(pId, NULL, startProcWrapper, (void*)startProc);
+  int result = pthread_create(pId, NULL, startProcWrapper, (void*)startProc);
+  if(!result)
+    pthread_detach(*pId);
+  return result;
 }
 
 OSThreadId