class Poller_poll

A class to monitor a set of file descriptors for readiness events.

Inheritance:


Public Methods

[more]int init()
Initialize the Poller
[more]void shutdown()
Release any resouces allocated internally by this Poller
[more]int add(int fd, Client* client, short eventmask)
Add a file descriptor to the set we monitor.
[more]int del(int fd)
Remove a file descriptor
[more]int setMask(int fd, short eventmask)
Give a new value for the given file descriptor's eventmask
[more]int orMask(int fd, short eventmask)
Set fd's eventmask to its present value OR'd with the given one
[more]int andMask(int fd, short eventmask)
Set fd's eventmask to its present value AND'd with the given one
[more]int waitForEvents(int timeout_millisec)
Sleep at most timeout_millisec waiting for an I/O readiness event on the file descriptors we're watching.
[more]int getNextEvent(PollEvent* e)
Get the next event that was found by waitForEvents.
[more]int waitAndDispatchEvents(int timeout_millisec)
Sleep at most timeout_millisec waiting for an I/O readiness event on the file descriptors we're watching, and dispatch events to the handler for each file descriptor that is ready for I/O.


Inherited from Poller:

Public Methods

ovirtual int setSignum(int signum)
ovirtual void clearReadiness(int fd, short eventmask)
oint initWakeUpPipe()
oint wakeUp()

Public Members

ostruct PollEvent
class Client
A class to handle a particular file descriptor's readiness events


Documentation

A class to monitor a set of file descriptors for readiness events. Current an efficient wrapper around the poll() system call. This is the code you would have written yourself if you had had the time...
oint init()
Initialize the Poller

ovoid shutdown()
Release any resouces allocated internally by this Poller

oint add(int fd, Client* client, short eventmask)
Add a file descriptor to the set we monitor.
Parameters:
- fd file descriptor to add
- client object to handle events for this fd. May use same client with more than one fd.
eventmask - initial event mask for this fd

oint del(int fd)
Remove a file descriptor

oint setMask(int fd, short eventmask)
Give a new value for the given file descriptor's eventmask

oint orMask(int fd, short eventmask)
Set fd's eventmask to its present value OR'd with the given one

oint andMask(int fd, short eventmask)
Set fd's eventmask to its present value AND'd with the given one

oint waitForEvents(int timeout_millisec)
Sleep at most timeout_millisec waiting for an I/O readiness event on the file descriptors we're watching. Fills internal array of readiness events. Call getNextEvent() repeatedly to read its contents.
Returns:
0 on success, EWOULDBLOCK if no events ready

oint getNextEvent(PollEvent* e)
Get the next event that was found by waitForEvents.
Returns:
0 on success, EWOULDBLOCK if no more events

oint waitAndDispatchEvents(int timeout_millisec)
Sleep at most timeout_millisec waiting for an I/O readiness event on the file descriptors we're watching, and dispatch events to the handler for each file descriptor that is ready for I/O. This is included as an example of how to use waitForEvents and getNextEvent. Real programs should probably avoid waitAndDispatchEvents and call waitForEvents and getNextEvent instead for maximum control over client deletion.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.