这个半残应该是说std::async返回的future必须绑定到一个左值?
就是说,如果你:
std::async(do_something, xxx); // 丢弃返回值
这一句其实和没用async一样,block执行在这一句,要等do_something结束才能到下一句?
所以std::future::~future()在c++14里面专门有一句:
These actions will not block for the shared state to become ready, except that they may block if all following conditions are satisfied:
The shared state was created by a call to std::async. <---
The shared state is not yet ready.
The current object was the last reference to the shared state.
至于实现,实现的不好是另一个问题。
【 在 speedboy2998 的大作中提到: 】
: 各个平台实现不一样。。
: 好像 WINDOWS 还是 LINUX 平台下,每次调用都会开启一个线程。。
: 如果是一个执行频繁并且执行过程比较长的调用,会导致最后有几千个线程。
: ...................
--
FROM 171.95.230.*