In my graphics application I want to generate a batch meshes in another thread. Therefore I asynchrony call the member function using std::async
.
ta
Use future::wait_for(). You can specify a timeout, and after that, get a status code.
task.wait_for(std::chrono::seconds(1));
This will return future_status::ready
, future_status::deferred
or future_status::timeout
, so you know the operation's status. You can also specify a timeout of 0 to have the check return immediately as soon as possible.
There's an is_ready member function in the works for std::future. In the meantime, the VC implementation has an _Is_ready() member.