libfluid
The ONF OpenFlow driver
Public Member Functions | Static Public Member Functions | Friends | List of all members
fluid_base::EventLoop Class Reference

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

fluid_base::EventLoop::EventLoop ( int  id)

Create a EventLoop.

Parameters
idevent loop id

Member Function Documentation

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 void* fluid_base::EventLoop::thread_adapter ( void *  arg)
static

This method is just an adapter for passing the EventLoop::run method to pthread_create.


The documentation for this class was generated from the following file: