From: Tim Laplaca (tlaplaca_at_[hidden])
Date: 2004-12-01 16:29:59
Caleb Epstein wrote:
> You can make a thread non-joinable, in which case it will
> automatically clean up after itself, by deleting the heap-allocated
> thread objects you create. The thread will continue to run, but it
> will become "detached" and you won't face this resource issue on
> thread exit.
I would have never thought of that, sounds dangerous! I tried it and it
seems to work though. Is that pretty safe?
Specifically, I'm spawning my threads like this:
boost::thread *ptr = thrds.create_thread(boost::bind (threadfunc,
(where thrds is a thread group)
My sample prog has made over 300,000 threads so far with this method, so
it seems pretty stable.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk