
16 Feb
2004
16 Feb
'04
5:33 p.m.
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