44 if (finished_)
return result_.Get();
46 auto old = started_.exchange(
true);
49 result_.SetValue(f_());
51 std::lock_guard lock(m_finished_);
55 result_.SetException(std::current_exception());
57 std::lock_guard lock(m_finished_);
63 std::unique_lock lock(m_finished_);
64 auto rc = cv_finished_.Wait(lock, [
this]() {
return finished_.load(); });