Y
yatko
Hi all;
I want to write a class as follows:
class Foo
{
public:
Foo();
~Foo()
void Start(void);
private:
boost::thread* ptr;
void Update(int x, int y);
};
void
Foo::Start(void)
{
ptr = new boost::thread( boost::bind( &Update, x, y) ); //
compiler complains here
}
All I want to do is creating a Foo object, initializing it and
creating a thread which is calling Update() member function after
calling Start() member function. However, compiler complains and says
that
"error: ISO C++ forbids taking the address of an unqualified or
parenthesized non-static member function to form a pointer to member
function."
It seems that creating a thread that calls a member function is
impossible, and called function must be static. However, I have to
call a member function as thread, since it performs some calculation
on object's attributes. How can I solve this problem? Any help,
suggestion will be appreciated.
Thanks
yatko
I want to write a class as follows:
class Foo
{
public:
Foo();
~Foo()
void Start(void);
private:
boost::thread* ptr;
void Update(int x, int y);
};
void
Foo::Start(void)
{
ptr = new boost::thread( boost::bind( &Update, x, y) ); //
compiler complains here
}
All I want to do is creating a Foo object, initializing it and
creating a thread which is calling Update() member function after
calling Start() member function. However, compiler complains and says
that
"error: ISO C++ forbids taking the address of an unqualified or
parenthesized non-static member function to form a pointer to member
function."
It seems that creating a thread that calls a member function is
impossible, and called function must be static. However, I have to
call a member function as thread, since it performs some calculation
on object's attributes. How can I solve this problem? Any help,
suggestion will be appreciated.
Thanks
yatko