$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-06-30 11:09:22
From: "Peter Dimov" <pdimov_at_[hidden]>
[Replying to myself... What's next? A dedicated mailing list just for me?
:-) ]
> So my point is that a good implementation of thread::ref can directly
> compete with the 'layer 1' noncopyable thread object and be an order of
> magnitude more efficient than 'layer 2' shared_ptr<thread>, while at the
> same time being more user-friendly.
Reality check.
The above is true with regard to thread-related resources, but it ignores
the problem with the lifetime of the arbitrary function object that is
passed to thread::create.
A design with
thread::ref thread::create(void (*) (void *), void *);
plus the corresponding helpers for managing the parameter passing and
dealing with different function signatures still has the properties outlined
above.
A design that takes boost::function0<void>, sadly, does not, as far as I can
see. Someone has to manage the function object, and the logical place to put
it is in the noncopyable thread.
-- Peter Dimov Multi Media Ltd.