0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd::ctx: Allow this_ctx::interruption toggle to no-op if no ctx.

This commit is contained in:
Jason Volk 2018-08-19 17:43:25 -07:00
parent b796668a77
commit ccf5b79e6a

View file

@ -565,21 +565,31 @@ ircd::ctx::this_ctx::stack_at_here()
/// Throws interrupted if the currently running context was interrupted
/// and clears the interrupt flag.
///
/// Unlike most of this_ctx::, this function is a no-op if not currently
/// on a context.
void
ircd::ctx::this_ctx::interruptible(const bool &b)
{
interruptible(b, std::nothrow);
interruption_point();
if(likely(current))
{
interruptible(cur(), b);
interruption_point();
}
}
/// Throws interrupted if the currently running context was interrupted
/// and clears the interrupt flag.
///
/// Unlike most of this_ctx::, this function is a no-op if not currently
/// on a context.
void
ircd::ctx::this_ctx::interruptible(const bool &b,
std::nothrow_t)
noexcept
{
interruptible(cur(), b);
if(likely(current))
interruptible(cur(), b);
}
/// Throws interrupted if the currently running context was interrupted