
31 Dec
2007
31 Dec
'07
5:49 p.m.
Solved my problem precisely. -- Xiaofan Li On Fri, 2007-12-28 at 20:34 +0200, Peter Dimov wrote:
Xiaofan Li:
...
for (int i = 0; i < 10; ++i) threads.create_thread( boost::bind( boost::mem_fn( &threaded::increment_count ), &_thrd, a ) );
Use
boost::bind( &threaded::increment_count, &_thrd, boost::ref( a ) )
to make boost::bind store a reference to 'a', rather than a copy. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users