Anklang C++ API 0.0.0
Loading...
Searching...
No Matches
PollFDSource

#include "loop.hh"

Inheritance diagram for PollFDSource:
[legend]

Static Public Member Functions

static PollFDSourcePcreate (const BPfdSlot &slot, int fd, const String &mode)
static PollFDSourcePcreate (const VPfdSlot &slot, int fd, const String &mode)

Protected Member Functions

virtual boolcheck (const LoopState &state)
voidconstruct (const String &mode)
virtual voiddestroy ()
virtual booldispatch (const LoopState &state)
virtual boolprepare (const LoopState &state, int64 *timeout_usecs_p)
virtual~PollFDSource ()
- Protected Member Functions inherited from EventSource
EventSource ()
uintn_pfds ()
uintsource_id ()
virtual~EventSource ()

Protected Attributes

uintnever_close_: 1
PollFDpfd_
- Protected Attributes inherited from EventSource
uintdispatching_: 1
uintid_
EventLoop *loop_
uint8loop_state_
uintmay_recurse_: 1
struct {
   uint   idx
   PollFD *   pfd
} *pfds_
uintprimary_: 1
int16priority_
uintwas_dispatching_: 1

Additional Inherited Members

- Public Member Functions inherited from EventSource
voidadd_poll (PollFD *const pfd)
voidloop_remove ()
MainLoop *main_loop () const
boolmay_recurse () const
voidmay_recurse (bool may_recurse)
boolprimary () const
voidprimary (bool is_primary)
boolrecursion () const
voidremove_poll (PollFD *const pfd)

Detailed Description

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

Constructor & Destructor Documentation

~PollFDSource()

~PollFDSource ( )
protectedvirtual

Member Function Documentation

construct()

void construct ( const String & mode)
protected

prepare()

bool prepare ( const LoopState & state,
int64 * timeout_usecs_p
)
protectedvirtual

Prepare the source for dispatching (true return) or polling (false).

Implements EventSource.

check()

bool check ( const LoopState & state)
protectedvirtual

Check the source and its PollFD descriptors for dispatching (true return).

Implements EventSource.

dispatch()

bool dispatch ( const LoopState & state)
protectedvirtual

Dispatch source, returns if it should be kept alive.

Implements EventSource.

destroy()

void destroy ( )
protectedvirtual

Reimplemented from EventSource.

create() [1/2]

static PollFDSourceP create ( const BPfdSlot & slot,
int fd,
const String & mode
)
static

create() [2/2]

static PollFDSourceP create ( const VPfdSlot & slot,
int fd,
const String & mode
)
static

Member Data Documentation

pfd_

PollFD pfd_
protected

never_close_

uint never_close_
protected

bool_poll_slot_

BPfdSlot bool_poll_slot_

void_poll_slot_

VPfdSlot void_poll_slot_