Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
ola::thread::ConsumerThread Class Reference

Detailed Description

A thread which waits on a queue, and when actions (callbacks) become available, it pulls them from the queue and executes them.

Inheritance diagram for ola::thread::ConsumerThread:
ola::thread::Thread

Public Types

typedef BaseCallback0< void > * Action

Public Member Functions

 ConsumerThread (std::queue< Action > *callback_queue, const bool *shutdown, Mutex *mutex, ConditionVariable *condition_var)
void * Run ()
- Public Member Functions inherited from ola::thread::Thread
virtual bool Start ()
virtual bool FastStart ()
virtual bool Join (void *ptr=NULL)
bool IsRunning ()
ThreadId Id () const
void * _InternalRun ()

Additional Inherited Members

- Static Public Member Functions inherited from ola::thread::Thread
static ThreadId Self ()

Constructor & Destructor Documentation

ola::thread::ConsumerThread::ConsumerThread ( std::queue< Action > *  callback_queue,
const bool *  shutdown,
Mutex mutex,
ConditionVariable condition_var 
)
inline
Parameters
callback_queuethe queue to pull actions from
shutdowna bool which is set to true if this thread is to finish.
mutexthe Mutex object which protects the queue and shutdown variable.
condition_varthe ConditionVariable to wait on. This signals when the queue is non-empty, or shutdown changes to true.

Member Function Documentation

void * ola::thread::ConsumerThread::Run ( )
virtual

The run method, this loops, executing actions, until we're told to terminate.

Implements ola::thread::Thread.


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