Add detach call so threads are GC'ed.

This commit is contained in:
Guido van Rossum 1997-04-30 19:59:22 +00:00
parent 03ef647847
commit f4806c2a85
1 changed files with 2 additions and 0 deletions

View File

@ -98,6 +98,8 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
init_thread(); init_thread();
success = pthread_create(&th, pthread_attr_default, success = pthread_create(&th, pthread_attr_default,
(void* (*) _P((void *)))func, arg); (void* (*) _P((void *)))func, arg);
if (success >= 0)
pthread_detach(th);
return success < 0 ? 0 : 1; return success < 0 ? 0 : 1;
} }