79 if (
auto result = x.get_try())
80 return stlab::detail::_get_optional<
decltype(result)>{}(std::move(result));
83 std::condition_variable condition;
86 auto hold = std::move(x).recover(stlab::immediate_executor, [&](
auto&& r) {
87 x = std::forward<decltype(r)>(r);
89 std::unique_lock<std::mutex> lock{m};
91 condition.notify_one();
95 #if STLAB_TASK_SYSTEM(PORTABLE)
96 if (!detail::pts().wake()) detail::pts().add_thread();
103 for (
auto backoff{std::chrono::steady_clock::duration{std::chrono::milliseconds{1}}};
true;
106 std::unique_lock<std::mutex> lock{m};
107 if (condition.wait_for(lock, backoff, [&] { return flag; })) {
111 detail::pts().wake();
117 std::unique_lock<std::mutex> lock{m};
118 condition.wait(lock, [&] {
return flag; });
123 return stlab::detail::_get_ready_future<T>{}(std::move(x));