$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-02 06:36:48
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));