Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] boost::thread automatically detached when thread terminates?
From: Eric J. Holtman (eric_at_[hidden])
Date: 2010-09-12 08:44:42


On 9/12/2010 7:39 AM, Boris Schaeling wrote:
>
> Thanks for your reply! Do you know whether the thread of execution is
> allowed to call boost::thread::detach()? Then it could detach itself
> from the boost::thread object before it terminates and
> boost::thread::joinable() should work? I'm not sure though if
> boost::thread is thread-safe?
>

What are you trying to accomplish?

If you don't care when a thread terminates, call detach right
after you create it:

main thread:
     boost::thread t (...);
     t.detach ();


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net