From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-07-03 17:04:39
> Well, you and others have convinced me that ref-counting is a price
> one shouldn't have to pay if they don't need it.
I have to repeat my question to Gary. In what real world situations is the
overhead of thread::ref unacceptable? [Note that thread::ref doesn't
necessarily mean reference counting; other implementations are possible;
even a reference counted implementation can be made more efficient than
shared_ptr because it can use intrusive counting and custom allocation.]
I'm thinking back to my previous job with embedded systems. I would like to
see boost::thread become std::thread. Thus if its in the interest of the
extremely limited OS to not ref count the threads, the language shouldn't
If we are not going to mandate it, but its useful in the general arena then
there should be a ref counted/copyable thread. Which the majority of UNIX,
PC, SUN, LINUX users should be encouraged to use.
Hence I'm still suggesting two layers. With the Caveat that Bill make the
first one as the non copyable thread class.
> If ref-counting is
> needed a second layer can be created, or more than likely
> shared_ptr<> can just be employed.
True. However, if the noncopyable thread object is never useful on its own,
without this second layer, then leaving the management to the implementation
(via thread::ref) is a good thing, since it enables implementors to use
With the second layer, the implementer can either be a pass through to the
native ref counted thread, or add ref counting to the non ref counted thread
with something like a thread safe shared_ptr.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk