|
Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
Loop object, polling for events and executing callbacks in accordance. More...
#include <loop.hh>
Inherits Rapicorn::ReferenceCountable.
Inherited by Rapicorn::MainLoop, and Rapicorn::SlaveLoop.
Classes | |
| class | DispatcherSource |
| EventLoop source for timer execution. More... | |
| class | PollFDSource |
| EventLoop source for IO callbacks. More... | |
| class | Source |
| EventLoop source for callback execution. More... | |
| struct | State |
| class | TimedSource |
| EventLoop source for timer execution. More... | |
Public Types | |
| typedef std::function< void(void)> | VoidSlot |
| typedef std::function< bool(void)> | BoolSlot |
| typedef std::function< void(PollFD &)> | VPfdSlot |
| typedef std::function< bool(PollFD &)> | BPfdSlot |
|
typedef std::function< bool(const State &)> | DispatcherSlot |
Public Member Functions | |
| void | wakeup () |
| Wakeup loop from polling. | |
| uint | add (Source *loop_source, int priority=PRIORITY_NORMAL) |
| Adds a new source to the loop with custom priority. | |
| void | remove (uint id) |
| Removes a source from loop, the source must be present. | |
| bool | try_remove (uint id) |
| Tries to remove a source, returns if successfull. | |
| void | kill_sources (void) |
| Remove all sources from this loop, prevents all further execution. | |
| bool | has_primary (void) |
| Indicates whether loop contains primary sources. | |
| bool | flag_primary (bool on) |
| template<class BoolVoidFunctor > | |
| uint | exec_now (BoolVoidFunctor &&bvf) |
| Execute a callback as primary source with priority "now" (highest), returning true repeats callback. | |
| template<class BoolVoidFunctor > | |
| uint | exec_next (BoolVoidFunctor &&bvf) |
| Execute a callback with priority "next" (very important), returning true repeats callback. | |
| template<class BoolVoidFunctor > | |
| uint | exec_notify (BoolVoidFunctor &&bvf) |
| Execute a callback with priority "notify" (important, for async callbacks), returning true repeats callback. | |
| template<class BoolVoidFunctor > | |
| uint | exec_normal (BoolVoidFunctor &&bvf) |
| Execute a callback with normal priority (round-robin for all events and requests), returning true repeats callback. | |
| template<class BoolVoidFunctor > | |
| uint | exec_update (BoolVoidFunctor &&bvf) |
| Execute a callback with priority "update" (important idle), returning true repeats callback. | |
| template<class BoolVoidFunctor > | |
| uint | exec_background (BoolVoidFunctor &&bvf) |
| Execute a callback with background priority (when idle), returning true repeats callback. | |
| MainLoop * | main_loop () const |
| Get the main loop for this loop. | |
| uint | exec_dispatcher (const DispatcherSlot &sl, int priority=PRIORITY_NORMAL) |
| Execute a single dispatcher callback for prepare, check, dispatch. | |
| template<class BoolVoidFunctor > | |
| uint | exec_timer (uint timeout_ms, BoolVoidFunctor &&bvf, int priority=PRIORITY_NORMAL) |
| Execute a callback after a specified timeout, returning true repeats callback. | |
| template<class BoolVoidFunctor > | |
| uint | exec_timer (uint initial_timeout_ms, uint repeat_timeout_ms, BoolVoidFunctor &&bvf, int priority=PRIORITY_NORMAL) |
| Execute a callback after a specified timeout with adjustable initial timeout, returning true repeats callback. | |
| template<class BoolVoidPollFunctor > | |
| uint | exec_io_handler (BoolVoidPollFunctor &&bvf, int fd, const String &mode, int priority=PRIORITY_NORMAL) |
| Execute a callback after polling for mode on fd, returning true repeats callback. | |
Static Public Attributes | |
| static const int | PRIORITY_NOW |
| Most important, used for immediate async execution (MAXINT/2) | |
| static const int | PRIORITY_HIGH |
| Very important, used for e.g. io handlers (G*HIGH) | |
| static const int | PRIORITY_NEXT |
| Still very important, used for need-to-be-async operations (G*HIGH) | |
| static const int | PRIORITY_NOTIFY |
| Important, delivers async callbacks (G*DEFAULT) | |
| static const int | PRIORITY_NORMAL |
| Normal importantance, interfaces to all layers (G*DEFAULT) | |
| static const int | PRIORITY_UPDATE |
| Mildly important, used for GUI updates or user information (G*HIGH_IDLE) | |
| static const int | PRIORITY_IDLE |
| Mildly important, used for GUI updates or user information (G*DEFAULT_IDLE) | |
| static const int | PRIORITY_BACKGROUND |
| Unimportant, used when everything else done (G*LOW) | |
Protected Types | |
| typedef std::vector< Source * > | SourceList |
Protected Member Functions | |
| EventLoop (MainLoop &) | |
| Source * | find_first_L () |
| Source * | find_source_L (uint id) |
| bool | has_primary_L (void) |
| void | remove_source_Lm (Source *source) |
| void | kill_sources_Lm (void) |
| void | unpoll_sources_U () |
| void | collect_sources_Lm (State &) |
| bool | prepare_sources_Lm (State &, int64 *, QuickPfdArray &) |
| bool | check_sources_Lm (State &, const QuickPfdArray &) |
| Source * | dispatch_source_Lm (State &) |
Protected Attributes | |
| MainLoop & | main_loop_ |
| SourceList | sources_ |
| int64 | dispatch_priority_ |
| QuickSourceArray & | poll_sources_ |
| uint64 | pollmem1 [3] |
| Source * | pollmem2 [7] |
| bool | primary_ |
Loop object, polling for events and executing callbacks in accordance.
| MainLoop* Rapicorn::EventLoop::main_loop | ( | ) | const [inline] |
Get the main loop for this loop.
1.7.6.1