Kyoto Tycoon
Public Member Functions

kyototycoon::Poller Class Reference

I/O event notification. More...

#include <ktsocket.h>

List of all members.

Public Member Functions

 Poller ()
 Default constructor.
 ~Poller ()
 Destructor.
const char * error ()
 Get the last happened error information.
bool open ()
 Open the poller.
bool close ()
 Close the poller.
bool deposit (Pollable *event)
 Add a pollable I/O event to the monitored list.
bool withdraw (Pollable *event)
 Remove a pollable I/O from the monitored list.
Pollablenext ()
 Fetch the next notified I/O event.
bool undo (Pollable *event)
 Enable the next notification of a pollable event.
bool wait (double timeout=-1)
 Wait one or more notifying events.
bool flush ()
 Notify all registered events.
int64_t count ()
 Get the number of events to watch.
bool abort ()
 Abort the current operation.

Detailed Description

I/O event notification.


Constructor & Destructor Documentation

kyototycoon::Poller::Poller ( ) [explicit]

Default constructor.

kyototycoon::Poller::~Poller ( )

Destructor.


Member Function Documentation

const char* kyototycoon::Poller::error ( )

Get the last happened error information.

Returns:
the last happened error information.
bool kyototycoon::Poller::open ( )

Open the poller.

Returns:
true on success, or false on failure.
bool kyototycoon::Poller::close ( )

Close the poller.

Returns:
true on success, or false on failure.
bool kyototycoon::Poller::deposit ( Pollable event)

Add a pollable I/O event to the monitored list.

Parameters:
eventthe pollable event object.
Returns:
true on success, or false on failure.
bool kyototycoon::Poller::withdraw ( Pollable event)

Remove a pollable I/O from the monitored list.

Parameters:
eventthe pollable event object.
Returns:
true on success, or false on failure.
Pollable* kyototycoon::Poller::next ( )

Fetch the next notified I/O event.

Returns:
the event object, or NULL on failure.
bool kyototycoon::Poller::undo ( Pollable event)

Enable the next notification of a pollable event.

Parameters:
eventthe pollable event object.
Returns:
true on success, or false on failure.
bool kyototycoon::Poller::wait ( double  timeout = -1)

Wait one or more notifying events.

Parameters:
timeoutthe timeout in seconds. If it is not more than 0, no timeout is specified.
Returns:
true on success, or false on failure.
bool kyototycoon::Poller::flush ( )

Notify all registered events.

Returns:
true on success, or false on failure.
int64_t kyototycoon::Poller::count ( )

Get the number of events to watch.

Returns:
the number of events to watch, or -1 on failure.
bool kyototycoon::Poller::abort ( )

Abort the current operation.

Returns:
true on success, or false on failure.