Boost logo

Boost :

From: Andreas Huber (ah2003_at_[hidden])
Date: 2004-02-16 12:33:43


Peter Dimov wrote:
> Sean Kelly wrote:
>>
>> The user could delete the object passed to boost::thread with the
>> existing design and there would be no provision for calling join.
>
> I think that you are wrong. A boost::thread makes a copy of its
> function object. The user can't delete it.

I think he meant the object indirectly referenced by boost::function:

MyActiveObject pActive = new MyActiveObject();
boost::thread myThread( boost::function< void () >(
  boost::bind( &MyActiveObject::Run, pActive ) ) );
delete pActive;

It's questionable however, whether it's a good idea not to use a smart
pointer here...

Regards,

Andreas


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