
Hi,
Thanks for your answers. Now I wonder how to a certain number of threads which is decided at runtime and can vary between program runs. I send the number of threads as an argument to CreateThreads.
// ----------- create a number of threads that is known at runtime --------
#include
Monica Gretzer wrote:
void TestThread::thread(int a) { cout << "I am thread " << a << endl; }
void TestThread::CreateThreads() { boost::thread t1( boost::bind( &TestThread::thread, 10)); boost::thread t2( boost::bind( &TestThread::thread, 20));
The ::thread method is non-static, and you don't pass any object to bind. You should have
boost::bind (&TestThread::thread, some_object, 10)
... or, in this case, since you probably want to call this->thread( 10 ) in a thread, you need boost::thread t1( boost::bind( &TestThread::thread, this, 10)); boost::thread t2( boost::bind( &TestThread::thread, this, 20)); _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users