Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions | Static Protected Member Functions
TaskQueue Class Referenceabstract

TaskQueue. More...

#include <TaskQueue.h>

Inheritance diagram for TaskQueue:
PolledQueue

Public Member Functions

 TaskQueue ()
 Create a TaskQueue. More...
 
virtual ~TaskQueue ()
 Destroy a TaskQueue. More...
 
virtual void post (TaskBase *event)=0
 Add this event to the queue for execution. More...
 
virtual void cancel (TaskBase *event)=0
 Cancel an in-flight event. More...
 

Static Protected Member Functions

static uint32_t task_size (TaskBase *task)
 Get the size required to run this task. More...
 
static TaskBase::run_callback_t task_start (TaskBase *task, uint8_t *dest, uint32_t size)
 Start processing this event by copying out its data. More...
 
static void task_finish (TaskBase *task)
 Finish processing this event. More...
 

Detailed Description

TaskQueue.

Flexible task queue for dispatching tasks

Definition at line 37 of file TaskQueue.h.

Constructor & Destructor Documentation

TaskQueue ( )

Create a TaskQueue.

Create an event queue.

Definition at line 44 of file TaskQueue.h.

virtual ~TaskQueue ( )
virtual

Destroy a TaskQueue.

Definition at line 51 of file TaskQueue.h.

Member Function Documentation

virtual void cancel ( TaskBase event)
pure virtual

Cancel an in-flight event.

Cancels the given event so the event's memory can be reused.

The cancel function is irq safe.

If called while the event queue's dispatch loop is active, the cancel function does not guarantee that the event will not execute after it returns, as the event may have already begun executing. It does guarantee that the event queue is no longer using event data so the event can be freed or reused.

Parameters
eventPointer to the event

Implemented in PolledQueue.

virtual void post ( TaskBase event)
pure virtual

Add this event to the queue for execution.

If the event is already in the queue then it is canceled and added to the end of the queue.

Parameters
eventPointer to the event

Implemented in PolledQueue.

static void task_finish ( TaskBase task)
staticprotected

Finish processing this event.

Inform this event that the callback has run to completion.

Parameters
taskThe task to finish processing
Note
Every call to event_finish must be preceded by a call to event_start
This call must be made in a critical section

Definition at line 131 of file TaskQueue.h.

static uint32_t task_size ( TaskBase task)
staticprotected

Get the size required to run this task.

Get the minimum size required for TaskQueue::task_start

Parameters
taskThe task to check size on
Returns
required size
Note
This call must be made in a critical section

Definition at line 93 of file TaskQueue.h.

static TaskBase::run_callback_t task_start ( TaskBase task,
uint8_t *  dest,
uint32_t  size 
)
staticprotected

Start processing this event by copying out its data.

Inform this event both that callback execution has started and that the event is free to be posted again.

Parameters
taskThe task to start processing
destThe buffer to copy the callback arguments to
sizemaximum size to copy
Returns
Pointer to function run
Note
event_start must not be called on a canceled event as the memory may have been freed already
Every call to event_start must be paired with event_finish
This call must be made in a critical section

Definition at line 115 of file TaskQueue.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.