Open Lighting Architecture: ola::thread::ConsumerThread Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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:

## Public Types
typedef BaseCallback0< void > * | Action

## Public Member Functions
| ConsumerThread (std::queue< Action > *callback_queue, const bool *shutdown, Mutex *mutex, ConditionVariable *condition_var, const Thread::Options &options=Thread::Options())
void * | Run ()
Public Member Functions inherited from ola::thread::Thread
| Thread (const Options &options=Options())
| Create a new thread with the specified thread options.
virtual | ~Thread ()
| Destructor.
virtual bool | Start ()
| Start the thread and wait for the thread to be running.
virtual bool | FastStart ()
| Start the thread and return immediately.
virtual bool | Join (void *ptr=NULL)
| Join this thread.
bool | IsRunning ()
| Check if the thread is running.
ThreadId | Id () const
| Return the thread id.
std::string | Name () const
| Return the thread name.

## Additional Inherited Members
Static Public Member Functions inherited from ola::thread::Thread
static ThreadId | Self ()
| Returns the current thread's id.

## Constructor & Destructor Documentation

## ◆ ConsumerThread()

ola::thread::ConsumerThread::ConsumerThread | ( | std::queue< Action > * | callback_queue,
|  | const bool * | shutdown,
|  | Mutex * | mutex,
|  | ConditionVariable * | condition_var,
|  | const Thread::Options & | options = Thread::Options() )
| inline

Parameters

  callback_queue | the queue to pull actions from
  shutdown | a bool which is set to true if this thread is to finish.
  mutex | the Mutex object which protects the queue and shutdown variable.
  condition_var | the ConditionVariable to wait on. This signals when the queue is non-empty, or shutdown changes to true.
  options | The thread options.

## Member Function Documentation

## ◆ Run()

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:

- include/ola/thread/ConsumerThread.h
- common/thread/ConsumerThread.cpp