Boost logo

Boost :

From: Sean Kelly (sean_at_[hidden])
Date: 2004-02-16 15:09:18


Peter Dimov wrote:
> 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.

Oops, I hadn't realized that.

>>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?

What if MyActiveObject has interface methods that need to be externally
accessible? Message queue endpoints, for example. Though other program
designs might obviate the need for such access methods.

Sean


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