#include <Pt/System/EventLoop.h>

Public Member Functions | |
| EventLoop () | |
| Constructs the EventLoop. | |
| virtual | ~EventLoop () |
| Destructs the EventLoop. | |
Protected Member Functions | |
| virtual void | onAdd (Selectable &s) |
| virtual void | onRemove (Selectable &s) |
| virtual void | onChanged (Selectable &s) |
| 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.