
2 Oct
2006
2 Oct
'06
10:36 a.m.
Vladimir Prus wrote:
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));