mercredi 26 septembre 2018

Is there a way to check if std::future state is ready in a guaranteed wait-free manner?

I know that I can check the state of the std::future the following way:

my_future.wait_for(std::chrono::seconds(0)) == std::future_status::ready

But according to cppreference.com std::future::wait_for may block in some cases:

This function may block for longer than timeout_duration due to scheduling or resource contention delays.

Is it still the case when timeout_duration is 0 ? If so, is there another way to query the state in a guaranteed wait-free manner ?

Aucun commentaire:

Enregistrer un commentaire