Boost logo

Boost :

Subject: Re: [boost] [thread] throw during new boost::thread() ??
From: Dave Abrahams (dave_at_[hidden])
Date: 2010-08-22 13:16:34


On Sun, Aug 22, 2010 at 9:07 AM, David M. Cotter <me_at_[hidden]> wrote:
>> If you're allocating with say new and forget to delete, you might be running out of thread handles as you'll have zombies hanging around.
>
> okay that explains it.  previously i had been using the pthread impl wrapped by MacOS thread manager calls.  in that impl, when a thread exits, it self-disposes.  i made an assumption (surprise) this would behave the same way.  when i put a "delete thread" in the destructor, everything started working again!!
>
> YAY thanks for that one little tip, something i should be well aware of at this point but you know, the forest / trees problem sometimes gets the best of us!

The next question might be why you are dynamically allocating thread
objects at all, and, if you really must, why you aren't managing them
with smart pointers.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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