I have a worker class like the one below:
class Worker{
public:
int Do(){
int ret = 100;
// do stuff
return ret;
}
}
It\'s
class Worker{
public:
int Do(){
int ret = 100;
// do stuff
return ret;
}
}
Worker worker;
boost::packaged_task ptask(boost::bind(&Worker::Do, &worker));
boost::unique_future future_int = ptask.get_future();
boost::thread th(boost::move(ptask));
th.join();
if (future_int.is_ready())
int return_value = future_int.get();
You can take a look at the "boost::future" concept, ref this link