#include <EventLoop.hh>
Public Member Functions | |
EventLoop (int id) | |
void | run () |
void | stop () |
Static Public Member Functions | |
static void * | thread_adapter (void *arg) |
Friends | |
class | BaseOFServer |
class | BaseOFConnection |
class | LibEventEventLoop |
A EventLoop runs an event loop for connections. It will activate the callbacks associated with them. The class using an EventLoop should tipically assign incoming connections in a round-robin fashion.
There might be more than one event loop in use in applications. In this case, each EventLoop can be run in a thread.
fluid_base::EventLoop::EventLoop | ( | int | id) |
Create a EventLoop.
id | event loop id |
void fluid_base::EventLoop::run | ( | ) |
Run this event loop (which will block the calling thread). When EventLoop::stop is called, this method will unblock, run the callbacks of pending events and return.
Calling EventLoop::stop first will prevent this method from running.
void fluid_base::EventLoop::stop | ( | ) |
Force the event loop to stop. It will finish running the current event callback and then force EventLoop::run to continue its flow (deal with remaining events and quit).
Calling this method first will prevent EventLoop::run from running.
|
static |
This method is just an adapter for passing the EventLoop::run method to pthread_create.