mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
ircd::ctx: Remove local typedef to use outer ircd:: typedef.
This commit is contained in:
parent
0866cf4f7f
commit
4e01d2c0a4
2 changed files with 10 additions and 11 deletions
|
@ -34,9 +34,6 @@
|
||||||
///
|
///
|
||||||
namespace ircd::ctx
|
namespace ircd::ctx
|
||||||
{
|
{
|
||||||
using std::chrono::steady_clock;
|
|
||||||
using time_point = steady_clock::time_point;
|
|
||||||
|
|
||||||
struct ctx;
|
struct ctx;
|
||||||
|
|
||||||
IRCD_EXCEPTION(ircd::error, error)
|
IRCD_EXCEPTION(ircd::error, error)
|
||||||
|
|
|
@ -33,12 +33,12 @@ inline namespace this_ctx
|
||||||
template<class E = timeout, class duration> throw_overload<E, duration> wait(const duration &);
|
template<class E = timeout, class duration> throw_overload<E, duration> wait(const duration &);
|
||||||
|
|
||||||
// Returns false if notified; true if time point reached, timeout thrown on throw_overloads
|
// Returns false if notified; true if time point reached, timeout thrown on throw_overloads
|
||||||
bool wait_until(const time_point &tp, const std::nothrow_t &);
|
bool wait_until(const steady_point &tp, const std::nothrow_t &);
|
||||||
template<class E> nothrow_overload<E, bool> wait_until(const time_point &tp);
|
template<class E> nothrow_overload<E, bool> wait_until(const steady_point &tp);
|
||||||
template<class E = timeout> throw_overload<E> wait_until(const time_point &tp);
|
template<class E = timeout> throw_overload<E> wait_until(const steady_point &tp);
|
||||||
|
|
||||||
// Ignores notes. Throws if interrupted.
|
// Ignores notes. Throws if interrupted.
|
||||||
void sleep_until(const time_point &tp);
|
void sleep_until(const steady_point &tp);
|
||||||
template<class duration> void sleep(const duration &);
|
template<class duration> void sleep(const duration &);
|
||||||
void sleep(const int &secs);
|
void sleep(const int &secs);
|
||||||
}}
|
}}
|
||||||
|
@ -74,10 +74,10 @@ ircd::ctx::this_ctx::sleep(const duration &d)
|
||||||
/// interruption point.
|
/// interruption point.
|
||||||
template<class E>
|
template<class E>
|
||||||
ircd::throw_overload<E>
|
ircd::throw_overload<E>
|
||||||
ircd::ctx::this_ctx::wait_until(const time_point &tp)
|
ircd::ctx::this_ctx::wait_until(const steady_point &tp)
|
||||||
{
|
{
|
||||||
if(wait_until<std::nothrow_t>(tp))
|
if(wait_until<std::nothrow_t>(tp))
|
||||||
throw E();
|
throw E{};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wait for a notification until a point in time. If there is a notification
|
/// Wait for a notification until a point in time. If there is a notification
|
||||||
|
@ -85,7 +85,7 @@ ircd::ctx::this_ctx::wait_until(const time_point &tp)
|
||||||
/// interruption point. this is not noexcept.
|
/// interruption point. this is not noexcept.
|
||||||
template<class E>
|
template<class E>
|
||||||
ircd::nothrow_overload<E, bool>
|
ircd::nothrow_overload<E, bool>
|
||||||
ircd::ctx::this_ctx::wait_until(const time_point &tp)
|
ircd::ctx::this_ctx::wait_until(const steady_point &tp)
|
||||||
{
|
{
|
||||||
return wait_until(tp, std::nothrow);
|
return wait_until(tp, std::nothrow);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,9 @@ ircd::throw_overload<E, duration>
|
||||||
ircd::ctx::this_ctx::wait(const duration &d)
|
ircd::ctx::this_ctx::wait(const duration &d)
|
||||||
{
|
{
|
||||||
const auto ret(wait<std::nothrow_t>(d));
|
const auto ret(wait<std::nothrow_t>(d));
|
||||||
return ret <= duration(0)? throw E() : ret;
|
return ret <= duration(0)?
|
||||||
|
throw E{}:
|
||||||
|
ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wait for a notification for some amount of time. This function returns
|
/// Wait for a notification for some amount of time. This function returns
|
||||||
|
|
Loading…
Reference in a new issue