Skip to content

Class Ase::PollFDSource

ClassList > Ase > PollFDSource

EventLoop source for IO callbacks.More...

  • #include <loop.hh>

Inherits the following classes: Ase::EventSource

Public Attributes

Type Name
BPfdSlot bool_poll_slot_
VPfdSlot void_poll_slot_

Public Attributes inherited from Ase::EventSource

See Ase::EventSource

Type Name
uint idx
PollFD * pfd

Public Functions inherited from Ase::EventSource

See Ase::EventSource

Type Name
void add_poll (PollFD *const pfd)
Add a PollFD descriptors for poll(2) andcheck() .
virtual bool check (const LoopState & state) = 0
Check the source and its PollFD descriptors for dispatching (true return).
virtual void destroy ()
virtual bool dispatch (const LoopState & state) = 0
Dispatch source, returns if it should be kept alive.
void loop_remove ()
Remove this source from its event loop if any.
MainLoop * main_loop () const
Get the main loop for this source.
bool may_recurse () const
Indicates if this source may recurse.
void may_recurse (bool may_recurse)
Dispatch this source if its running recursively.
virtual bool prepare (const LoopState & state, int64 * timeout_usecs_p) = 0
Prepare the source for dispatching (true return) or polling (false).
bool primary () const
Indicate whether this source is primary.
void primary (bool is_primary)
Set whether this source prevents its loop from exiting.
bool recursion () const
Indicates wether the source is currently in recursion.
void remove_poll (PollFD *const pfd)
Remove a previously added PollFD .

Public Static Functions

Type Name
PollFDSourceP create (const BPfdSlot & slot, int fd, const String & mode)
PollFDSourceP create (const VPfdSlot & slot, int fd, const String & mode)

Protected Attributes

Type Name
uint never_close_
PollFD pfd_

Protected Attributes inherited from Ase::EventSource

See Ase::EventSource

Type Name
uint dispatching_
uint id_
EventLoop * loop_
uint8 loop_state_
uint may_recurse_
struct Ase::EventSource * pfds_
uint primary_
int16 priority_
uint was_dispatching_

Protected Functions

Type Name
virtual bool check (const LoopState & state)
Check the source and its PollFD descriptors for dispatching (true return).
void construct (const String & mode)
virtual void destroy ()
virtual bool dispatch (const LoopState & state)
Dispatch source, returns if it should be kept alive.
virtual bool prepare (const LoopState & state, int64 * timeout_usecs_p)
Prepare the source for dispatching (true return) or polling (false).
virtual ~PollFDSource ()

Protected Functions inherited from Ase::EventSource

See Ase::EventSource

Type Name
EventSource ()
uint n_pfds ()
uint source_id ()
virtual ~EventSource ()

Detailed Description

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

Public Attributes Documentation

variable bool_poll_slot_

BPfdSlot Ase::PollFDSource::bool_poll_slot_;

variable void_poll_slot_

VPfdSlot Ase::PollFDSource::void_poll_slot_;

Public Static Functions Documentation

function create [1/2]

static inline PollFDSourceP Ase::PollFDSource::create (
    const BPfdSlot & slot,
    int fd,
    const String & mode
) 

function create [2/2]

static inline PollFDSourceP Ase::PollFDSource::create (
    const VPfdSlot & slot,
    int fd,
    const String & mode
) 

Protected Attributes Documentation

variable never_close_

uint Ase::PollFDSource::never_close_;

variable pfd_

PollFD Ase::PollFDSource::pfd_;

Protected Functions Documentation

function check

virtual bool Ase::PollFDSource::check (
    const LoopState & state
) 

Implements Ase::EventSource::check


function construct

void Ase::PollFDSource::construct (
    const String & mode
) 

function destroy

virtual void Ase::PollFDSource::destroy () 

Implements Ase::EventSource::destroy


function dispatch

virtual bool Ase::PollFDSource::dispatch (
    const LoopState & state
) 

Implements Ase::EventSource::dispatch


function prepare

virtual bool Ase::PollFDSource::prepare (
    const LoopState & state,
    int64 * timeout_usecs_p
) 

Implements Ase::EventSource::prepare


function ~PollFDSource

virtual Ase::PollFDSource::~PollFDSource () 


The documentation for this class was generated from the following file /__w/anklang/anklang/ase/loop.hh