#include <SelectMultiplexer.hpp>
Inheritance diagram for Ionflux::Tools::SelectMultiplexer:
Public Member Functions | |
SelectMultiplexer () | |
Constructor. | |
virtual | ~SelectMultiplexer () |
Destructor. | |
virtual void | registerEvent (IOHandler *handler, IOEvent event) |
Register IO event. | |
virtual void | removeEvent (IOHandler *handler, IOEvent event) |
Remove IO event. | |
virtual void | run () |
Main loop. | |
virtual void | quit () |
Exit main loop. | |
virtual bool | isRunning () |
Get running state. | |
virtual Reporter & | getLog () |
Get Console output/logging facility. | |
Static Public Member Functions | |
static void | shutdownHandler (int signum) |
Shutdown handler. | |
Protected Member Functions | |
virtual void | clearEvent (IOEventInfo *eventInfo) |
Clear event. | |
virtual void | clearEvents () |
Remove events flagged for removal. | |
virtual void | addEvent (IOEventInfo *eventInfo) |
Add event. | |
virtual void | addEvents () |
Add events flagged for registration. | |
Protected Attributes | |
Ionflux::Tools::Reporter | log |
Console output/logging. | |
std::vector< IOEventInfo * > | events |
Vector of registered IO events. | |
std::vector< IOEventInfo * > | trash |
Vector of IO events to be removed. | |
std::vector< IOEventInfo * > | newEvents |
Vector of IO events to be added. | |
FDSet | fds |
File descriptor set. | |
bool | running |
Main loop flag. | |
Static Protected Attributes | |
static sig_atomic_t | shutdown = 0 |
Shutdown flag. |
A multiplexer for IO events. If a specified event is ready to be processed, the IO multiplexer notifies the associated IO handler. For example, an IOHandler may be called if a file descriptor is ready for reading.
To register an event, you set a file descriptor and a mask of event types which the IO handler should be notified of. You then call IOMultiplexer::registerEvent() with a pointer to an IOHandler and the event object. To remove (unregister) an event, call IOMultiplexer::removeEvent() with the same handler and event object.
|
Constructor. Construct new SelectMultiplexer object. |
|
Destructor. Destruct SelectMultiplexer object. |
|
Add event. Add an event to the vector of registered events.
|
|
Add events flagged for registration.
|
|
Clear event. Removes an event from the vector of registered events.
|
|
Remove events flagged for removal.
|
|
Get Console output/logging facility.
Implements Ionflux::Tools::IOMultiplexer. |
|
Get running state.
Implements Ionflux::Tools::IOMultiplexer. |
|
Exit main loop. Call this function to exit from the main loop. Implements Ionflux::Tools::IOMultiplexer. |
|
Register IO event. Register an IO event to be handled by the multiplexer.
Implements Ionflux::Tools::IOMultiplexer. |
|
Remove IO event. Remove an IO event from the set of events handled by the multiplexer.
Implements Ionflux::Tools::IOMultiplexer. |
|
Main loop. Watch for registered events. Implements Ionflux::Tools::IOMultiplexer. |
|
Shutdown handler. Signal handler for signals that will cause the main loop to exit.
Reimplemented from Ionflux::Tools::IOMultiplexer. |
|
Vector of registered IO events.
|
|
File descriptor set.
|
|
Console output/logging.
|
|
Vector of IO events to be added.
|
|
Main loop flag.
|
|
Shutdown flag.
|
|
Vector of IO events to be removed.
|