#include <iostream>
#include <chrono>
#include <future>
using namespace std::literals;
int main()
{
std::promise<void> prom;
auto fut = prom.get_future();
std::cout << std::boolalpha << (
std::future_status::timeout ==
fut.wait_for(std::chrono::seconds::max())
);
}
The code should output nothing, because fut.wait_for
will wait for a very very long time. However, it outputs true
in no time!
Why does std::future::wait_for
not behave as expected?
Aucun commentaire:
Enregistrer un commentaire