From e6426918c012d0cf916965cebe6b965ea46234c7 Mon Sep 17 00:00:00 2001
From: rpj
pthread_detach puts the thread th in the detached -state. This guarantees that the memory resources consumed by th -will be freed immediately when th terminates. However, this +state. This guarantees that the resources consumed by th will +be freed immediately when th terminates. However, this prevents other threads from synchronizing on the termination of th -using pthread_join. -
+using pthread_join. If, when pthread_detach is called, +th has already terminated, all of th's remaining +resources will be freed.A thread can be created initially in the detached state, using the detachstate attribute to pthread_create(3) . In contrast, pthread_detach applies to threads created in @@ -37,8 +38,9 @@ later.
After pthread_detach completes, subsequent attempts to perform pthread_join on th will fail. If another thread is already joining the thread th at the time pthread_detach -is called, pthread_detach does nothing and leaves th in -the joinable state. +is called, th will be detached and pthread_join +will eventually return when th terminates but may not return +with th's correct return code.
On success, 0 is returned. On error, a non-zero error code is @@ -58,6 +60,7 @@ returned. Author
Xavier Leroy <Xavier.Leroy@inria.fr>
+Modified by Ross Johnson for use with Pthreads-w32.
pthread_create(3) , pthread_join(3) , @@ -83,4 +86,4 @@ returned.