Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-06-28 16:04:15


If you want to join, you don't create a detached thread in the first
place, and you don't need to detach in the destructor because the join
does the cleanup. Note I'm using POSIX threads definitions here.

I have a bad feeling that a lot of time is being wasted because some
people are talking Win32 and some are talking POSIX. I'm currently
printing out the MSDN docs to figure out the relation between the Win32
defs and the POSIX defs.

On Thu, 28 Jun 2001, Bill Klein wrote:
> Jeremy Siek wrote:
> > If the thread is going to be detached, why not just create it as
> > detached from the start, instead of waiting until the destructor? I
> > don't see how the lifetime of some thread ref object has anything
> > to do with a detached thread.
>
> As others mentioned, you don't want to create the ref detatched in
> case you would like to join later or whatever. There can be an
> explicit detach() method to detatch right away if you like (in fact
> I'd say there should be). The point of having it in the destructor is
> just for the purposes of normal resource management: if you don't do
> anything explicit, resources will still be freed correctly (ex. in
> Win32 detach is implemented as CloseHandle() which would cause a
> resource leak if not called).
>
> - Bill
>
>
> Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
 Summer Manager, AT&T Research phone: (973) 360-8185
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk