Reimplement async::future::ready without a wait

This commit is contained in:
Nikita Lisitsa 2022-07-04 18:22:22 +03:00
parent 06313a0234
commit e62fc51052

View file

@ -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 <typename F>