0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::ctx: Inline the interruptible/uninterruptible instanced interface.

This commit is contained in:
Jason Volk 2020-02-19 08:40:15 -08:00
parent 74c9978800
commit 43f5ebe8e3
2 changed files with 76 additions and 67 deletions

View file

@ -52,3 +52,65 @@ struct ircd::ctx::this_ctx::uninterruptible::nothrow
nothrow(const nothrow &) = delete;
~nothrow() noexcept;
};
//
// uninterruptible
//
inline
ircd::ctx::this_ctx::uninterruptible::uninterruptible()
:theirs
{
interruptible(cur())
}
{
interruptible(false);
}
inline
ircd::ctx::this_ctx::uninterruptible::~uninterruptible()
noexcept(false)
{
interruptible(theirs);
}
//
// uninterruptible::nothrow
//
inline
ircd::ctx::this_ctx::uninterruptible::nothrow::nothrow()
noexcept
:theirs
{
interruptible(cur())
}
{
interruptible(false, std::nothrow);
}
inline
ircd::ctx::this_ctx::uninterruptible::nothrow::~nothrow()
noexcept
{
interruptible(theirs, std::nothrow);
}
//
// interruptible
//
inline void
ircd::ctx::this_ctx::interruptible(const bool &b,
std::nothrow_t)
noexcept
{
interruptible(cur(), b);
}
inline bool
ircd::ctx::this_ctx::interruptible()
noexcept
{
return interruptible(cur());
}

View file

@ -797,40 +797,6 @@ ircd::ctx::this_ctx::stack_at_here()
return cur().stack.base - uintptr_t(__builtin_frame_address(0));
}
/// Throws interrupted if the currently running context was interrupted
/// and clears the interrupt flag.
void
ircd::ctx::this_ctx::interruptible(const bool &b)
{
const bool theirs
{
interruptible(cur())
};
if(theirs && !b)
interruption_point();
interruptible(cur(), b);
if(!theirs && b)
interruption_point();
}
void
ircd::ctx::this_ctx::interruptible(const bool &b,
std::nothrow_t)
noexcept
{
interruptible(cur(), b);
}
bool
ircd::ctx::this_ctx::interruptible()
noexcept
{
return interruptible(cur());
}
/// Throws interrupted if the currently running context was interrupted
/// and clears the interrupt flag.
void
@ -862,46 +828,27 @@ noexcept
}
//
// uinterruptible
// interruptible
//
/// Throws interrupted if the currently running context was interrupted
/// and clears the interrupt flag.
[[gnu::hot]]
ircd::ctx::this_ctx::uninterruptible::uninterruptible()
:theirs
void
ircd::ctx::this_ctx::interruptible(const bool &b)
{
interruptible(cur())
}
{
interruptible(false);
}
const bool theirs
{
interruptible(cur())
};
[[gnu::hot]]
ircd::ctx::this_ctx::uninterruptible::~uninterruptible()
noexcept(false)
{
interruptible(theirs);
}
if(theirs && !b)
interruption_point();
//
// uninterruptible::nothrow
//
interruptible(cur(), b);
[[gnu::hot]]
ircd::ctx::this_ctx::uninterruptible::nothrow::nothrow()
noexcept
:theirs
{
interruptible(cur())
}
{
interruptible(false, std::nothrow);
}
[[gnu::hot]]
ircd::ctx::this_ctx::uninterruptible::nothrow::~nothrow()
noexcept
{
interruptible(theirs, std::nothrow);
if(!theirs && b)
interruption_point();
}
//