0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 16:46:50 +01:00

ircd::ctx::future: Add non-std get() w/ durations to avoid separate wait().

This commit is contained in:
Jason Volk 2019-08-12 20:43:39 -07:00
parent b4842da414
commit 0efc56c9c7

View file

@ -57,6 +57,8 @@ struct ircd::ctx::future
void wait() const;
T get();
template<class duration> T get(const duration &d);
template<class time_point> T get_until(const time_point &);
future() = default;
future(promise<T> &promise);
@ -209,6 +211,24 @@ noexcept
invalidate(state());
}
template<class T>
template<class time_point>
T
ircd::ctx::future<T>::get_until(const time_point &tp)
{
this->wait_until(tp);
return this->get();
}
template<class T>
template<class duration>
T
ircd::ctx::future<T>::get(const duration &d)
{
this->wait(d);
return this->get();
}
template<class T>
T
ircd::ctx::future<T>::get()