#include <cxxtools/eventloop.h>

Public Member Functions | |
| EventLoop () | |
| Constructs the EventLoop. | |
| virtual | ~EventLoop () |
| Destructs the EventLoop. | |
Protected Member Functions | |
| virtual void | onAdd (Selectable &s) |
| A Selectable is added to this Selector. | |
| virtual void | onRemove (Selectable &s) |
| A Selectable is removed from this Selector. | |
| virtual void | onReinit (Selectable &s) |
| A Selectable is reinitialised and needs to be updated. | |
| virtual void | onChanged (Selectable &s) |
| A Selectable in this Selector has changed. | |
| virtual void | onRun () |
| virtual bool | onWait (std::size_t msecs) |
| virtual void | onWake () |
| virtual void | onExit () |
| virtual void | onCommitEvent (const Event &event) |
| virtual void | onProcessEvents () |
Events can be added to the internal event queue, even from other threads using the method EventLoop::commitEvent or EventLoop::queueEvent. The first method will add the event to the internal queue and wake the event loop, the latter allows queing multiple event and it is up to the caller to wake the event loop by calling EventLoop::wake when all events are added. When the event loop processes its event, the signal "event" is send for each processed event. Events are processes in the order they were added.
To start the EventLoop the method EventLoop::run must be executed. It block until the event loop is stopped. To stop the EventLoop, EventLoop::exit must be called. The delivery of the events occurs inside the Thread that started the execution of the event loop.
IODevices and Timers can be added to an EventLoop just as to Selector. In fact a Selector is used internally to implement the EventLoop.
Since the EventLoop is a Runnable, it can be easily assigned to a Thread to give it its own event loop.
| virtual void onAdd | ( | Selectable & | ) | [protected, virtual] |
Do not throw exceptions.
Implements SelectorBase.
| virtual void onRemove | ( | Selectable & | ) | [protected, virtual] |
Do not throw exceptions.
Implements SelectorBase.
| virtual void onReinit | ( | Selectable & | ) | [protected, virtual] |
Do not throw exceptions.
Implements SelectorBase.
| virtual void onChanged | ( | Selectable & | s | ) | [protected, virtual] |
Do not throw exceptions.
Implements SelectorBase.