hronizing on the termination of <I>th</I>
using <B>pthread_join</B>. If, when <B>pthread_detach</B> is called,
<I>th</I> has already terminated, all of <I>th</I>'s remaining
resources will be freed.</P>
<P>A thread can be created initially in the detached state, using the
<B>detachstate</B> attribute to <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A>
. In contrast, <B>pthread_detach</B> applies to threads created in
the joinable state, and which need to be put in the detached state
later. 
</P>
<