I have a worker class like the one below:
class Worker{
public:
int Do(){
int ret = 100;
// do stuff
return ret;
}
}
It\'s
In addition, you also have some redundant calls to boost::bind() and boost::function(). You can instead do the following:
class Worker{
public:
void operator(){
int ret = 100;
// do stuff
m_ReturnValue = ret;
}
int m_ReturnValue;
}
Worker worker;
boost::thread th(worker());//or boost::thread th(boost::ref(worker));
You can do this because Thread's constructor is a convenience wrapper around an internal bind() call. Thread Constructor with arguments