|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-02-16 12:47:04
Andreas Huber wrote:
> 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;
Why would anyone want to do that?
boost::thread myThread(
boost::bind( &MyActiveObject::Run, MyActiveObject() )
);
Or if Run is renamed to operator():
boost::thread myThread( MyActiveObject() );
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk