120 return static_cast<SchedulerCaps>(
static_cast<std::uint32_t
>(a) |
static_cast<std::uint32_t
>(b));
123 return static_cast<SchedulerCaps>(
static_cast<std::uint32_t
>(a) &
static_cast<std::uint32_t
>(b));
132 return static_cast<std::uint32_t
>(a & b) != 0;
146 using std::logic_error::logic_error;
167 std::function<
void()> fn) {
168 (void)delay; (void)fn;
170 "IScheduler::schedule_after: this scheduler does not advertise "
171 "SchedulerCaps::Delay");
185 return has_all(s.caps(), required);
191 const char* context =
"scheduler") {
194 +
": required SchedulerCaps not advertised by this scheduler");
Definition scheduler.hpp:152
virtual void schedule(std::function< void()> fn)=0
Submit fn for execution "soon". Defines Caps::Post.
virtual SchedulerCaps caps() const noexcept=0
Capability bitmask.
virtual bool is_main_thread() const noexcept
True iff the calling thread is the scheduler's "main" thread.
Definition scheduler.hpp:177
virtual ~IScheduler()=default
virtual void schedule_after(std::chrono::milliseconds delay, std::function< void()> fn)
Submit fn for execution after delay.
Definition scheduler.hpp:166
Thrown when a caller invokes a capability the scheduler did not advertise (e.g.
Definition scheduler.hpp:144
#define ARIA_ABI_API
Definition export.hpp:21
constexpr bool has_any(SchedulerCaps a, SchedulerCaps b) noexcept
Definition scheduler.hpp:131
constexpr SchedulerCaps operator&(SchedulerCaps a, SchedulerCaps b) noexcept
Definition scheduler.hpp:122
constexpr SchedulerCaps & operator&=(SchedulerCaps &a, SchedulerCaps b) noexcept
Definition scheduler.hpp:128
bool has_caps(const IScheduler &s, SchedulerCaps required) noexcept
Definition scheduler.hpp:184
constexpr bool has_all(SchedulerCaps a, SchedulerCaps b) noexcept
Definition scheduler.hpp:134
constexpr SchedulerCaps & operator|=(SchedulerCaps &a, SchedulerCaps b) noexcept
Definition scheduler.hpp:125
void require_caps(const IScheduler &s, SchedulerCaps required, const char *context="scheduler")
Throwing accessor — useful at component construction time when missing a capability is a programmer e...
Definition scheduler.hpp:190
SchedulerCaps
Definition scheduler.hpp:83
@ Post
Can submit "fire now" work.
Definition scheduler.hpp:89
@ GraphSafe
Safe to use as the graph-thread executor — i.e.
Definition scheduler.hpp:107
@ Pumpable
Posted work is held in a queue until a pump-style call drains it (e.g.
Definition scheduler.hpp:102
@ None
Definition scheduler.hpp:84
@ Autonomous
Implementation does not require any external pump and runs work on background threads autonomously.
Definition scheduler.hpp:116
@ Delay
Can submit work after a wall-clock or virtual-time delay.
Definition scheduler.hpp:93
@ MainThread
Submitted work runs on a single, identifiable "main" thread that is consistent across calls.
Definition scheduler.hpp:97
@ WorkerSafe
Safe to host blocking worker tasks (e.g.
Definition scheduler.hpp:111
constexpr SchedulerCaps operator|(SchedulerCaps a, SchedulerCaps b) noexcept
Definition scheduler.hpp:119
Definition validation_key.hpp:110