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).
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