CppCMS
Classes | Public Member Functions | Static Public Attributes | List of all members
booster::aio::reactor Class Reference

This class is an abstraction of platform dependent polling API. More...

#include <booster/booster/aio/reactor.h>

Inheritance diagram for booster::aio::reactor:
booster::aio::io_events

Classes

struct  event
 structure that defines output events More...
 

Public Member Functions

 reactor (int hint=use_default)
 
void select (native_type fd, int flags)
 
void select (native_type fd, int flags, system::error_code &e)
 
void remove (native_type fd)
 
void remove (native_type fd, system::error_code &e)
 
int poll (event *events, int n, int timeout)
 
int poll (event *events, int n, int timeout, system::error_code &e)
 
std::string name () const
 

Static Public Attributes

static const int use_default = 0
 
static const int use_select = 1
 
static const int use_poll = 2
 
static const int use_epoll = 3
 
static const int use_dev_poll = 4
 
static const int use_kqueue = 5
 
static const int use_max = use_kqueue
 
- Static Public Attributes inherited from booster::aio::io_events
static const int in = 1 << 0
 
static const int out = 1 << 1
 
static const int err = 1 << 2
 

Detailed Description

This class is an abstraction of platform dependent polling API.

It abstracts platform specific APIs like epoll, /dev/poll, kqueue, poll and select.

It provides platform independent functionality for polling file descriptions in an efficient way

Constructor & Destructor Documentation

booster::aio::reactor::reactor ( int  hint = use_default)

Create a new polling device using hint recommendation. If provided device is not supported the default is used

Member Function Documentation

std::string booster::aio::reactor::name ( ) const

Get the actual name of the polling device used.

int booster::aio::reactor::poll ( event events,
int  n,
int  timeout 
)

Poll for the events, wait at most timeout microseconds. Save up to n values to the events vector.

Returns number of events recorded. Returns 0 if timeout occurred.

If error occurs throws system::system_error

int booster::aio::reactor::poll ( event events,
int  n,
int  timeout,
system::error_code e 
)

Poll for the events, wait at most timeout microseconds. Save up to n values to the events vector.

Returns number of events recorded. Returns 0 if timeout occurred.

If error occurs, the error code is assigned to e

void booster::aio::reactor::remove ( native_type  fd)
inline

Removes the fd from the watch list

If error occurs throws system::system_error

void booster::aio::reactor::remove ( native_type  fd,
system::error_code e 
)
inline

Removes the fd from the watch list

If error occurs, the error code is assigned to e

void booster::aio::reactor::select ( native_type  fd,
int  flags 
)

Add fd to watch list, flags can be a or mask of io_events::in, io_events::out and io_events::err

If flags=0 removes the fd from the watch list

If error occurs throws system::system_error

void booster::aio::reactor::select ( native_type  fd,
int  flags,
system::error_code e 
)

Add fd to watch list, flags can be a or mask of io_events::in, io_events::out and io_events::err

If flags=0 removes the fd from the watch list

If error occurs, the error code is assigned to e


The documentation for this class was generated from the following file: