Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
EventLoop source for IO callbacks. More...
#include "loop.hh"
Static Public Member Functions | |
static PollFDSourceP | create (const BPfdSlot &slot, int fd, const String &mode) |
static PollFDSourceP | create (const VPfdSlot &slot, int fd, const String &mode) |
Protected Member Functions | |
void | construct (const String &mode) |
virtual bool | prepare (const LoopState &state, int64 *timeout_usecs_p) |
Prepare the source for dispatching (true return) or polling (false). | |
virtual bool | check (const LoopState &state) |
Check the source and its PollFD descriptors for dispatching (true return). | |
virtual bool | dispatch (const LoopState &state) |
Dispatch source, returns if it should be kept alive. | |
virtual void | destroy () |
![]() | |
uint | n_pfds () |
uint | source_id () |
Protected Attributes | ||
PollFD | pfd_ | |
uint | never_close_: 1 | |
![]() | ||
EventLoop * | loop_ | |
struct { | ||
PollFD * | pfd | |
uint | idx | |
} * | pfds_ | |
uint | id_ | |
int16 | priority_ | |
uint8 | loop_state_ | |
uint | may_recurse_: 1 | |
uint | dispatching_: 1 | |
uint | was_dispatching_: 1 | |
uint | primary_: 1 | |
Additional Inherited Members | |
![]() | |
bool | recursion () const |
Indicates wether the source is currently in recursion. | |
bool | may_recurse () const |
Indicates if this source may recurse. | |
void | may_recurse (bool may_recurse) |
Dispatch this source if its running recursively. | |
bool | primary () const |
Indicate whether this source is primary. | |
void | primary (bool is_primary) |
Set whether this source prevents its loop from exiting. | |
void | add_poll (PollFD *const pfd) |
Add a PollFD descriptors for poll(2) and check(). | |
void | remove_poll (PollFD *const pfd) |
Remove a previously added PollFD. | |
void | loop_remove () |
Remove this source from its event loop if any. | |
MainLoop * | main_loop () const |
Get the main loop for this source. | |
EventLoop source for IO callbacks.
A PollFDSource can be used to execute a callback function from the main loop, depending on certain file descriptor states. The modes supported for polling the file descriptor are as follows:
"r"
- poll readable (POLLIN) "w"
- poll writable (POLLOUT) "p"
- priority data (POLLPRI) "d"
- priority band writable (POLLWRBAND) "b"
- set fd blocking "B"
- set fd non-blocking "C"
- prevent auto close on destroy Check the source and its PollFD descriptors for dispatching (true return).
Implements Ase::EventSource.
|
protected |
|
static |
|
static |
|
protectedvirtual |
Reimplemented from Ase::EventSource.
Dispatch source, returns if it should be kept alive.
Implements Ase::EventSource.
Definition at line 1327 of file loop.cc.
References close().
|
protectedvirtual |
Prepare the source for dispatching (true return) or polling (false).
Implements Ase::EventSource.