Boost logo

Boost Users :

From: Marc Mutz (marc_at_[hidden])
Date: 2006-02-14 17:43:29


On Tuesday 14 February 2006 22:34, Steven Wooding wrote:
> void MyClass::spawn_threads()
> {
>   for ( int ii = 0; ii < num_threads; ++ii)
>   {
>      threadGroup.create_thread( boost::bind( ChildThreadFunc, _1, ii));
>   }
> }
>
> void MyClass::ChildThreadFunc( int &threadNumber)
> {
>   // Does some work
> }

C++ question. Use &MyClass::ChildThreadFunction as bind's first argument. You
will probably also run into trouble with passing the int by reference (why?).
Pass it by value.

Marc

-- 
Marc Mutz -- marc_at_[hidden], mutz_at_[hidden]
Klarälvdalens Datakonsult AB, Platform-independent software solutions

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net