如何在c ++中运行异步升压功能?

时间:2018-03-20 11:15:10

标签: c++11 asynchronous boost-asio c++17

有谁知道如何使用boost运行异步函数,假设我想异步运行foo和bar函数?就像python中的asyncio函数一样。

演示代码

void foo(){ }
void bar(){ }

int main(){ return 0;}

提前致谢。

1 个答案:

答案 0 :(得分:0)

如果您只想并行运行bar<future>,则可以使用int main() { auto f = std::async(std::launch::async, &foo); bar(); } - 无需提升:

OrderSelect(i,SELECT_BY_POS)