Event Loops

Detailed Description

Application is the console process root. There is one instance. It uses an EventLoop. run() enters that loop. exit() leaves it. Command line arguments, environment variables, the working directory, and C signals are Application services.

EventLoop is the dispatch core of a thread or process. It is an EventSink. commitEvent() queues an event and wakes the loop. queueEvent() queues without waking. wake() starts processing. Events are delivered on eventReceived in the thread that called run(). MainLoop is the platform EventLoop.

A Selectable attaches with setActive so the loop can wait for it. detach() removes it and cancels outstanding operations. Timer is not a Selectable. It registers with setActive and emits timeout at an interval.

EventSource sends events to EventSink objects in other threads. Signal is not thread-safe. EventSource is.

Classes

class  Application
 Console process root. More...
 
class  EventLoop
 Event loop of a thread or process. More...
 
class  AsyncYield
 Awaitable that schedules a resume in the EventLoop. More...
 
class  EventSink
 Receiver for events. More...
 
class  EventSource
 Sends events to sinks in other threads. More...
 
class  MainLoop
 Platform event loop. More...
 
class  Selectable
 Operation that runs through an event loop. More...
 
class  Timer
 Interval timeout notifications. More...
 
class  AsyncWait
 Awaitable for async one-shot timer delay. More...