
16 Feb
2004
16 Feb
'04
5:47 p.m.
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() );