clan::KeepAlive Class Reference

KeepAlive application loop helper. More...

#include <keep_alive.h>

Static Public Member Functions

static Callback_v1< void * > & func_awake_thread ()
 Function that gets called when KeepAliveObject::set_wakeup_event is called. More...
 
static Callback_2< int, const
std::vector< Event > &, int > & 
func_event_wait ()
 Function that polls the events. More...
 
static Callback_0< void * > & func_thread_id ()
 Function that gets called when KeepAliveObject objects are created. More...
 
static std::vector
< KeepAliveObject * > 
get_objects ()
 Returns all the current keep alive objects available for this thread. More...
 
static void process (int timeout=0)
 Processes and dispatches keep alive events until the specified timeout period has passed. More...
 

Detailed Description

KeepAlive application loop helper.

Member Function Documentation

static Callback_v1<void *>& clan::KeepAlive::func_awake_thread ( )
static

Function that gets called when KeepAliveObject::set_wakeup_event is called.

This callback is used to provide a way to awaken a thread that needs to process keep alive events.

static Callback_2<int , const std::vector<Event> &, int >& clan::KeepAlive::func_event_wait ( )
static

Function that polls the events.

If this is not set, Event::wait() is used.

Parameters
events= The event objects to wait for
timeout= Timeout (ms). -1 = Wait forever
Returns
The event that triggered an event.
-1 = Timeout events.size() = An external event was triggered
static Callback_0<void *>& clan::KeepAlive::func_thread_id ( )
static

Function that gets called when KeepAliveObject objects are created.

This callback is used to provide a thread identifier for the func_awake_thread callback.

static std::vector<KeepAliveObject *> clan::KeepAlive::get_objects ( )
static

Returns all the current keep alive objects available for this thread.

static void clan::KeepAlive::process ( int  timeout = 0)
static

Processes and dispatches keep alive events until the specified timeout period has passed.

Parameters
timeout= Timeout (ms). -1 = Wait forever

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