FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Classes | Public Member Functions | Private Attributes | List of all members
cpp_freertos::WorkQueue Class Reference

#include <workqueue.hpp>

Collaboration diagram for cpp_freertos::WorkQueue:
Collaboration graph
[legend]

Classes

class  CWorkerThread
 

Public Member Functions

 WorkQueue (const char *const Name, uint16_t StackDepth=(configMINIMAL_STACK_SIZE *2), UBaseType_t Priority=(tskIDLE_PRIORITY+1), UBaseType_t MaxWorkItems=10)
 
 WorkQueue (uint16_t StackDepth=(configMINIMAL_STACK_SIZE *2), UBaseType_t Priority=(tskIDLE_PRIORITY+1), UBaseType_t MaxWorkItems=10)
 
 ~WorkQueue ()
 
bool QueueWork (WorkItem *work)
 

Private Attributes

CWorkerThreadWorkerThread
 
QueueWorkItemQueue
 
BinarySemaphoreThreadComplete
 

Detailed Description

This class is the "engine" for WorkItems. Create one or more WorkQueues to accept WorkItems. WorkQueues pull WorkItems off of a FIFO queue and run them sequentially.

Definition at line 126 of file workqueue.hpp.

Constructor & Destructor Documentation

◆ WorkQueue() [1/2]

WorkQueue::WorkQueue ( const char *const  Name,
uint16_t  StackDepth = (configMINIMAL_STACK_SIZE * 2),
UBaseType_t  Priority = (tskIDLE_PRIORITY + 1),
UBaseType_t  MaxWorkItems = 10 
)

Constructor to create a named WorkQueue.

Exceptions
ThreadCreateException,QueueCreateException,SemaphoreCreateException
Parameters
NameName of the thread internal to the WorkQueue. Only useful for debugging.
StackDepthNumber of "words" allocated for the Thread stack.
PriorityFreeRTOS priority of this Thread.
MaxWorkItemsMaximum number of WorkItems this WorkQueue can hold.

Definition at line 63 of file cworkqueue.cpp.

◆ WorkQueue() [2/2]

WorkQueue::WorkQueue ( uint16_t  StackDepth = (configMINIMAL_STACK_SIZE * 2),
UBaseType_t  Priority = (tskIDLE_PRIORITY + 1),
UBaseType_t  MaxWorkItems = 10 
)

Constructor to create an unnamed WorkQueue.

Exceptions
ThreadCreateException,QueueCreateException,SemaphoreCreateException
Parameters
StackDepthNumber of "words" allocated for the Thread stack.
PriorityFreeRTOS priority of this Thread.
MaxWorkItemsMaximum number of WorkItems this WorkQueue can hold.

Definition at line 82 of file cworkqueue.cpp.

◆ ~WorkQueue()

WorkQueue::~WorkQueue ( )

Our destructor.

Note
Given the multithreaded nature of this class, the dtor may block until the underlying Thread has had a chance to clean up.

Definition at line 102 of file cworkqueue.cpp.

Member Function Documentation

◆ QueueWork()

bool WorkQueue::QueueWork ( WorkItem work)

Send a WorkItem off to be executed.

Parameters
workPointer to a WorkItem.
Returns
true if it was queued, false otherwise.
Note
This function may block if the WorkQueue is presently full.

Definition at line 137 of file cworkqueue.cpp.

Member Data Documentation

◆ ThreadComplete

BinarySemaphore* cpp_freertos::WorkQueue::ThreadComplete
private

Semaphore to support deconstruction without race conditions.

Definition at line 240 of file workqueue.hpp.

◆ WorkerThread

CWorkerThread* cpp_freertos::WorkQueue::WorkerThread
private

Pointer to our WorkerThread.

Definition at line 230 of file workqueue.hpp.

◆ WorkItemQueue

Queue* cpp_freertos::WorkQueue::WorkItemQueue
private

Pointer to our work queue itself.

Definition at line 235 of file workqueue.hpp.


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