mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
ircd::ctx: Stack uninterruptible's gracefully; assume context.
This commit is contained in:
parent
c7080bf144
commit
ff66bc441c
2 changed files with 17 additions and 9 deletions
|
@ -146,6 +146,8 @@ struct ircd::ctx::this_ctx::uninterruptible
|
|||
{
|
||||
struct nothrow;
|
||||
|
||||
bool theirs;
|
||||
|
||||
uninterruptible();
|
||||
uninterruptible(uninterruptible &&) = delete;
|
||||
uninterruptible(const uninterruptible &) = delete;
|
||||
|
@ -159,6 +161,8 @@ struct ircd::ctx::this_ctx::uninterruptible
|
|||
///
|
||||
struct ircd::ctx::this_ctx::uninterruptible::nothrow
|
||||
{
|
||||
bool theirs;
|
||||
|
||||
nothrow() noexcept;
|
||||
nothrow(nothrow &&) = delete;
|
||||
nothrow(const nothrow &) = delete;
|
||||
|
|
22
ircd/ctx.cc
22
ircd/ctx.cc
|
@ -577,11 +577,8 @@ ircd::ctx::this_ctx::stack_at_here()
|
|||
void
|
||||
ircd::ctx::this_ctx::interruptible(const bool &b)
|
||||
{
|
||||
if(likely(current))
|
||||
{
|
||||
interruptible(cur(), b);
|
||||
interruption_point();
|
||||
}
|
||||
interruptible(cur(), b);
|
||||
interruption_point();
|
||||
}
|
||||
|
||||
/// Throws interrupted if the currently running context was interrupted
|
||||
|
@ -594,8 +591,7 @@ ircd::ctx::this_ctx::interruptible(const bool &b,
|
|||
std::nothrow_t)
|
||||
noexcept
|
||||
{
|
||||
if(likely(current))
|
||||
interruptible(cur(), b);
|
||||
interruptible(cur(), b);
|
||||
}
|
||||
|
||||
/// Throws interrupted if the currently running context was interrupted
|
||||
|
@ -635,6 +631,10 @@ ircd::ctx::this_ctx::name()
|
|||
//
|
||||
|
||||
ircd::ctx::this_ctx::uninterruptible::uninterruptible()
|
||||
:theirs
|
||||
{
|
||||
interruptible(cur())
|
||||
}
|
||||
{
|
||||
interruptible(false);
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ ircd::ctx::this_ctx::uninterruptible::uninterruptible()
|
|||
ircd::ctx::this_ctx::uninterruptible::~uninterruptible()
|
||||
noexcept(false)
|
||||
{
|
||||
interruptible(true);
|
||||
interruptible(theirs);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -651,6 +651,10 @@ noexcept(false)
|
|||
|
||||
ircd::ctx::this_ctx::uninterruptible::nothrow::nothrow()
|
||||
noexcept
|
||||
:theirs
|
||||
{
|
||||
interruptible(cur())
|
||||
}
|
||||
{
|
||||
interruptible(false, std::nothrow);
|
||||
}
|
||||
|
@ -658,7 +662,7 @@ noexcept
|
|||
ircd::ctx::this_ctx::uninterruptible::nothrow::~nothrow()
|
||||
noexcept
|
||||
{
|
||||
interruptible(true, std::nothrow);
|
||||
interruptible(theirs, std::nothrow);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue