Note that this is different from calling valid()
. valid()
indicates whether the future has a valid shared state at all, however what I want to know is whether a value for the future has been set (i.e. via std::promise::set_value
).
There's a wait_for
method, however I don't want the calling thread to block at all, I just want to check for the presence of a value. Theoretically, I could call wait_for
with a zero duration, but I don't know if it's actually the preferred way of doing this and I'm not sure what the expected behavior is when wait_for
is called with a zero duration.
Aucun commentaire:
Enregistrer un commentaire