Boost logo

Boost :

From: Bill Klein (bill_at_[hidden])
Date: 2001-06-28 14:49:07

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at