Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::thread destructor and detach()
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2010-04-01 04:32:47


"Eric J. Holtman" <eric_at_[hidden]> writes:

> It looks like the new C++ standard threading library
> is going to call terminate() on a thread if it's being
> destructed, and has not been detached or joined.
>
> Is boost::thread going to change to emulate that
> behavior? (Currently, it calls detach(), not terminate()).

Maybe.

> I hadn't been calling detach () in my programs
> when I was spinning off a thread that I didn't
> care about joining later. Should I be doing that,
> just so my code works with either library?

Yes. It is clearer to explicitly detach your threads.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

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