FreeRTOS Addons
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
cpp_freertos::WorkQueue Class Reference

#include <workqueue.hpp>

Public Member Functions

 WorkQueue (const char *const Name, uint16_t StackDepth=DEFAULT_WORK_QUEUE_STACK_SIZE, UBaseType_t Priority=DEFAULT_WORK_QUEUE_PRIORITY, UBaseType_t MaxWorkItems=DEFAULT_MAX_WORK_ITEMS)
 
 WorkQueue (uint16_t StackDepth=DEFAULT_WORK_QUEUE_STACK_SIZE, UBaseType_t Priority=DEFAULT_WORK_QUEUE_PRIORITY, UBaseType_t MaxWorkItems=DEFAULT_MAX_WORK_ITEMS)
 
 ~WorkQueue ()
 
 ~WorkQueue ()=delete
 
bool QueueWork (WorkItem *work)
 

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.

Constructor & Destructor Documentation

◆ WorkQueue() [1/2]

WorkQueue::WorkQueue ( const char *const  Name,
uint16_t  StackDepth = DEFAULT_WORK_QUEUE_STACK_SIZE,
UBaseType_t  Priority = DEFAULT_WORK_QUEUE_PRIORITY,
UBaseType_t  MaxWorkItems = DEFAULT_MAX_WORK_ITEMS 
)

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.

◆ WorkQueue() [2/2]

WorkQueue::WorkQueue ( uint16_t  StackDepth = DEFAULT_WORK_QUEUE_STACK_SIZE,
UBaseType_t  Priority = DEFAULT_WORK_QUEUE_PRIORITY,
UBaseType_t  MaxWorkItems = DEFAULT_MAX_WORK_ITEMS 
)

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.

◆ ~WorkQueue() [1/2]

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.

◆ ~WorkQueue() [2/2]

cpp_freertos::WorkQueue::~WorkQueue ( )
delete

If we can't delete a task, it makes no sense to have a destructor.

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.

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