【发布时间】:2015-01-07 13:44:34
【问题描述】:
int xxx()
{
return 5;
}
int main()
{
boost::thread th;
th = boost::thread(xxx);
th.join();
return 0;
}
如何在不使用 boost::promise 的情况下捕获 xxx() 方法返回的值?
【问题讨论】:
-
你为什么不想使用promise?唯一的选择是写一些做同样事情的东西,这似乎毫无意义。
-
其实我想在 main 中改变一些东西,方法 xxx() 是不可编辑的
-
@Bakkya boost::future?
-
@UldisK boost::future 只有在我们使用 boost::promise 时才能使用。但我不想使用 boost::promise
-
@UldisK 我得到了正确的解决方案!请参考以下答案
标签: c++ boost boost-thread