[M3devel] pthread_create => pthread_join?

Tony Hosking hosking at cs.purdue.edu
Mon Nov 30 15:45:57 CET 2009


pthread_join is unnecessary.  pthread_detach is sufficient.  pthread_detach before pthread_join is an error.  pthread_join without pthread_detach is a convenience.

On 30 Nov 2009, at 05:20, Jay K wrote:

> I was wondering..how does one cleanup the result of pthread_create?
>  
> http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_join.html
>  
> "It is unspecified whether a thread that has exited but remains unjoined counts against _POSIX_THREAD_THREADS_MAX"
>  
>  
> We never call pthread_join.
> We have our own mechanism.
> We should probably call pthread_join though?
>  
> Or detach is sufficient?
>  
> http://www.opengroup.org/onlinepubs/000095399/functions/pthread_detach.html
>  
> "The pthread_join() or pthread_detach() functions should eventually be called for every thread that is created so that storage associated with the thread may be reclaimed
> "
>  
> But what about the wording pthread_join?
>  
>  - Jay

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091130/c9d6cb8c/attachment-0002.html>


More information about the M3devel mailing list