Reimplement async::future::ready without a wait
This commit is contained in:
parent
06313a0234
commit
e62fc51052
1 changed files with 3 additions and 1 deletions
|
|
@ -158,7 +158,9 @@ namespace psemek::async
|
||||||
|
|
||||||
bool ready() const
|
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>
|
template <typename F>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue