mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::ctx: Add some noexcept; minor comment justification.
This commit is contained in:
parent
00fe4baa2a
commit
3c96120e72
2 changed files with 30 additions and 27 deletions
|
@ -39,39 +39,39 @@ namespace ircd::ctx
|
||||||
IRCD_EXCEPTION(ircd::error, error)
|
IRCD_EXCEPTION(ircd::error, error)
|
||||||
IRCD_EXCEPTION(error, interrupted)
|
IRCD_EXCEPTION(error, interrupted)
|
||||||
IRCD_EXCEPTION(error, timeout)
|
IRCD_EXCEPTION(error, timeout)
|
||||||
struct terminated {}; // Special exception
|
struct terminated {}; // Special exception
|
||||||
|
|
||||||
IRCD_OVERLOAD(threadsafe)
|
IRCD_OVERLOAD(threadsafe)
|
||||||
bool is_main_thread() noexcept;
|
bool is_main_thread() noexcept;
|
||||||
void assert_main_thread();
|
void assert_main_thread();
|
||||||
|
|
||||||
const uint64_t &id(const ctx &) noexcept; // Unique ID for context
|
const uint64_t &id(const ctx &) noexcept; // Unique ID for context
|
||||||
string_view name(const ctx &) noexcept; // User's optional label for context
|
string_view name(const ctx &) noexcept; // User's optional label for context
|
||||||
const uint32_t &flags(const ctx &) noexcept; // Direct flags access
|
const uint32_t &flags(const ctx &) noexcept; // Direct flags access
|
||||||
const int32_t ¬es(const ctx &) noexcept; // Peeks at internal semaphore count
|
const int32_t ¬es(const ctx &) noexcept; // Peeks at internal semaphore count
|
||||||
const uint64_t &epoch(const ctx &) noexcept; // Context switching counter
|
const uint64_t &epoch(const ctx &) noexcept; // Context switching counter
|
||||||
const ulong &cycles(const ctx &) noexcept; // Accumulated tsc (not counting cur slice)
|
const ulong &cycles(const ctx &) noexcept; // Accumulated tsc (not counting cur slice)
|
||||||
const int8_t &ionice(const ctx &) noexcept; // IO priority nice-value
|
const int8_t &ionice(const ctx &) noexcept; // IO priority nice-value
|
||||||
const int8_t &nice(const ctx &) noexcept; // Scheduling priority nice-value
|
const int8_t &nice(const ctx &) noexcept; // Scheduling priority nice-value
|
||||||
bool interruptible(const ctx &) noexcept; // Context can throw at interruption point
|
bool interruptible(const ctx &) noexcept; // Context can throw at interruption point
|
||||||
bool interruption(const ctx &) noexcept; // Context was marked for interruption
|
bool interruption(const ctx &) noexcept; // Context was marked for interruption
|
||||||
bool termination(const ctx &) noexcept; // Context was marked for termination
|
bool termination(const ctx &) noexcept; // Context was marked for termination
|
||||||
bool finished(const ctx &) noexcept; // Context function returned (or exception).
|
bool finished(const ctx &) noexcept; // Context function returned (or exception).
|
||||||
bool started(const ctx &) noexcept; // Context was ever entered.
|
bool started(const ctx &) noexcept; // Context was ever entered.
|
||||||
bool running(const ctx &) noexcept; // Context is the currently running ctx.
|
bool running(const ctx &) noexcept; // Context is the currently running ctx.
|
||||||
bool waiting(const ctx &) noexcept; // started() && !finished() && !running()
|
bool waiting(const ctx &) noexcept; // started() && !finished() && !running()
|
||||||
bool queued(const ctx &) noexcept; // !running() && notes() > 0
|
bool queued(const ctx &) noexcept; // !running() && notes() > 0
|
||||||
|
|
||||||
uint32_t &flags(ctx &) noexcept; // Direct flags access
|
uint32_t &flags(ctx &) noexcept; // Direct flags access
|
||||||
int8_t ionice(ctx &, const int8_t &); // IO priority nice-value
|
int8_t ionice(ctx &, const int8_t &) noexcept; // IO priority nice-value
|
||||||
int8_t nice(ctx &, const int8_t &); // Scheduling priority nice-value
|
int8_t nice(ctx &, const int8_t &) noexcept; // Scheduling priority nice-value
|
||||||
void interruptible(ctx &, const bool &); // False for interrupt suppression.
|
void interruptible(ctx &, const bool &) noexcept; // False for interrupt suppression.
|
||||||
void interrupt(ctx &); // Interrupt the context.
|
void interrupt(ctx &); // Interrupt the context.
|
||||||
void terminate(ctx &); // Interrupt for termination.
|
void terminate(ctx &); // Interrupt for termination.
|
||||||
void signal(ctx &, std::function<void ()>); // Post function to context strand
|
void signal(ctx &, std::function<void ()>); // Post function to context strand
|
||||||
void notify(ctx &, threadsafe_t); // Notify context with threadsafety.
|
void notify(ctx &, threadsafe_t); // Notify context with threadsafety.
|
||||||
bool notify(ctx &) noexcept; // Queue a context switch to arg
|
bool notify(ctx &) noexcept; // Queue a context switch to arg
|
||||||
void yield(ctx &); // Direct context switch to arg
|
void yield(ctx &); // Direct context switch to arg
|
||||||
|
|
||||||
bool for_each(const std::function<bool (ctx &)> &);
|
bool for_each(const std::function<bool (ctx &)> &);
|
||||||
const uint64_t &epoch() noexcept;
|
const uint64_t &epoch() noexcept;
|
||||||
|
|
|
@ -514,6 +514,7 @@ ircd::ctx::interrupt(ctx &ctx)
|
||||||
void
|
void
|
||||||
ircd::ctx::interruptible(ctx &ctx,
|
ircd::ctx::interruptible(ctx &ctx,
|
||||||
const bool &b)
|
const bool &b)
|
||||||
|
noexcept
|
||||||
{
|
{
|
||||||
if(b)
|
if(b)
|
||||||
ctx.flags &= ~context::NOINTERRUPT;
|
ctx.flags &= ~context::NOINTERRUPT;
|
||||||
|
@ -524,6 +525,7 @@ ircd::ctx::interruptible(ctx &ctx,
|
||||||
int8_t
|
int8_t
|
||||||
ircd::ctx::nice(ctx &ctx,
|
ircd::ctx::nice(ctx &ctx,
|
||||||
const int8_t &val)
|
const int8_t &val)
|
||||||
|
noexcept
|
||||||
{
|
{
|
||||||
ctx.nice = val;
|
ctx.nice = val;
|
||||||
return ctx.nice;
|
return ctx.nice;
|
||||||
|
@ -532,6 +534,7 @@ ircd::ctx::nice(ctx &ctx,
|
||||||
int8_t
|
int8_t
|
||||||
ircd::ctx::ionice(ctx &ctx,
|
ircd::ctx::ionice(ctx &ctx,
|
||||||
const int8_t &val)
|
const int8_t &val)
|
||||||
|
noexcept
|
||||||
{
|
{
|
||||||
ctx.ionice = val;
|
ctx.ionice = val;
|
||||||
return ctx.ionice;
|
return ctx.ionice;
|
||||||
|
|
Loading…
Reference in a new issue