diff --git a/libs/async/include/psemek/async/future.hpp b/libs/async/include/psemek/async/future.hpp index ecefbcea..7a281526 100644 --- a/libs/async/include/psemek/async/future.hpp +++ b/libs/async/include/psemek/async/future.hpp @@ -158,7 +158,9 @@ namespace psemek::async bool ready() const { - return wait_for(std::chrono::seconds{0}); + if (!state_) throw empty_future_error{}; + std::unique_lock lock(state_->value_mutex); + return has_value_unsafe(); } template