
Thanks, it turns out I don't need to object class so I dropped it. Tim -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Peter Dimov Sent: Monday, November 22, 2004 5:57 PM To: boost@lists.boost.org Subject: Re: [boost] boost.thread : Can one create a thread with anobjectmember function? Tim Laplaca wrote:
boost::thread_group thrds;
objclass * objthread;
objthread = new objclass;
thrds.create_thread( (objthread->p) );
Do this instead: boost::shared_ptr<objclass> objthread( new objclass ); thrds.create_thread( boost::bind( &objclass::dowork, objthread ) ); Even better, drop the objclass entirely and do this: void dowork( int tid, string valtwo ) { // do work } thrds.create_thread( boost::bind( dowork, my_thread_id, my_valtwo ) ); _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost