Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-06-28 17:05:18

OK, you've convinced me :)

On Thu, 28 Jun 2001, Bill Klein wrote:
> I use both pthreads and Win32 threads so that's not the problem. I'll
> try restrict what I say here to posix wording. :)
> You're suggesting that the boost thread library should allow you to
> create a thread "already detached" like pthreads does. Ok, even
> supposing this was a good idea, what if you didn't create the thread
> "already detached" (with the intention of joining some time later) but
> then forgot to join. The destructor will still need to detach to do
> resource cleanup.
> But enough of that, I don't think we need to be adding an extra
> parameter to create_thread() to specify that it's already detached,
> because you can do it oh so much more elegantly then that by
> detaching in the destructor of the ref. You want to create an
> already detached thread? Try this:
> create_thread( whatever );
> Because you've ignored the return value its destructor was called and
> it was detached. Exactly what one would expect with a call like that:
> the thread is being created and let go to do its own thing. You want
> to join at some later point?
> ref thread = create_thread( whatever );
> ...
> ...
> thread->join();
> You can't lose!

 Jeremy Siek www:
 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, gregod at, cpdaniel at, john at