class
EventLoopLoop object, polling for events and executing callbacks in accordance.
Derived classes
Public static variables
- static const int16 PRIORITY_ASCENT
- Threshold for priorization across different loops.
- static const int16 PRIORITY_CEILING
- Internal upper limit, don't use.
- static const int16 PRIORITY_HIGH
- Very important, used for timers or IO handlers.
- static const int16 PRIORITY_IDLE
- Mildly important, used for background tasks.
- static const int16 PRIORITY_LOW
- Unimportant, used when everything else done.
- static const int16 PRIORITY_NEXT
- Important, used for async operations and callbacks.
- static const int16 PRIORITY_NORMAL
- Normal importantance, GUI event processing, RPC.
- static const int16 PRIORITY_NOW
- Most important, used for immediate async execution.
- static const int16 PRIORITY_UPDATE
- Mildly important, used for GUI updates or user information.
Public functions
-
auto add(EventSourceP loop_source,
int priority = PRIORITY_
NORMAL) → uint - Adds a new source to the loop with custom priority.
- auto clear_source(uint* id_pointer) → bool
- Remove source if
id_pointer
and*id_pointer
are valid. - void destroy_loop(void)
-
template <class BoolVoidFunctor>auto exec_callback(BoolVoidFunctor&& bvf, int priority = PRIORITY_
NORMAL) → uint - Execute a callback at user defined priority returning true repeats callback.
-
template <class BoolVoidFunctor>auto exec_idle(BoolVoidFunctor&& bvf) → uint
- Execute a callback with priority "idle", returning true repeats callback.
-
template <class BoolVoidPollFunctor>auto exec_io_handler(BoolVoidPollFunctor&& bvf, int fd, const String& mode, int priority = PRIORITY_
NORMAL) → uint - Execute a callback after polling for mode on fd, returning true repeats callback.
-
template <class BoolVoidFunctor>auto exec_now(BoolVoidFunctor&& bvf) → uint
- Execute a callback as primary source with priority "now" (highest), returning true repeats callback.
-
auto exec_once(uint delay_ms,
uint* once_id,
const VoidSlot& vfunc,
int priority = PRIORITY_
NORMAL) → bool - Execute a signal callback for prepare, check, dispatch.
-
template <class BoolVoidFunctor>auto exec_timer(BoolVoidFunctor&& bvf, uint delay_ms, int64 repeat_ms = -1, int priority = PRIORITY_
NORMAL) → uint - Execute a callback after a specified timeout with adjustable initial timeout, returning true repeats callback.
-
auto exec_usignal(int8 signum,
const USignalSlot& sl,
int priority = PRIORITY_
NOW -1) → uint - Execute a single dispatcher callback for prepare, check, dispatch.
- auto has_primary(void) → bool
- Indicates whether loop contains primary sources.
- auto main_loop() const → MainLoop*
- Get the main loop for this loop.
- void remove(uint id)
- Removes a source from loop, the source must be present.
- auto try_remove(uint id) → bool
- Tries to remove a source, returns if successfull.
- void wakeup()
- Wakeup loop from polling.
Function documentation
void Ase:: EventLoop:: destroy_loop(void)
Remove all sources from a loop and prevent any further execution. The destroy_
bool Ase:: EventLoop:: exec_once(uint delay_ms,
uint* once_id,
const VoidSlot& vfunc,
int priority = PRIORITY_ NORMAL)
Execute a signal callback for prepare, check, dispatch.
Execute a callback once, re-schedules the callback if 0 != *once_id
.