Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
PolledQueue Class Reference
[PolledQueue class]
#include <PolledQueue.h>
Inherits events::TaskQueue.
Public Member Functions | |
PolledQueue (mbed::Callback< void()> cb=NULL) | |
Create a PolledQueue. | |
virtual void | post (TaskBase *event) |
Add this event to the queue for execution. | |
virtual void | cancel (TaskBase *event) |
Cancel an in-flight event. | |
void | dispatch () |
Process all the events in this queue. | |
void | attach (mbed::Callback< void()> cb) |
Attach a callback indicating that this queue needs to be processed. | |
Static Protected Member Functions | |
static uint32_t | task_size (TaskBase *task) |
Get the size required to run this task. | |
static TaskBase::run_callback_t | task_start (TaskBase *task, uint8_t *dest, uint32_t size) |
Start processing this event by copying out its data. | |
static void | task_finish (TaskBase *task) |
Finish processing this event. |
Detailed Description
This class is an implementation of TaskQueue which is processed synchronously by calls to dispatch.
Definition at line 36 of file PolledQueue.h.
Constructor & Destructor Documentation
PolledQueue | ( | mbed::Callback< void()> | cb = NULL ) |
Create a PolledQueue.
Create an event queue.
- Parameters:
-
cb Callback called when dispatch needs to be called
Member Function Documentation
void attach | ( | mbed::Callback< void()> | cb ) |
Attach a callback indicating that this queue needs to be processed.
- Parameters:
-
cb Callback called when dispatch needs to be called
virtual void cancel | ( | TaskBase * | event ) | [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:
-
event Pointer to the event
Implements TaskQueue.
void dispatch | ( | ) |
Process all the events in this queue.
virtual void post | ( | TaskBase * | event ) | [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:
-
event Pointer to the event
Implements TaskQueue.
static void task_finish | ( | TaskBase * | task ) | [static, protected, inherited] |
Finish processing this event.
Inform this event that the callback has run to completion.
- Parameters:
-
task The 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 133 of file TaskQueue.h.
static uint32_t task_size | ( | TaskBase * | task ) | [static, protected, inherited] |
Get the size required to run this task.
Get the minimum size required for TaskQueue::task_start
- Parameters:
-
task The task to check size on
- Returns:
- required size
- Note:
- This call must be made in a critical section
Definition at line 95 of file TaskQueue.h.
static TaskBase::run_callback_t task_start | ( | TaskBase * | task, |
uint8_t * | dest, | ||
uint32_t | size | ||
) | [static, protected, inherited] |
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:
-
task The task to start processing dest The buffer to copy the callback arguments to size maximum 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 117 of file TaskQueue.h.
Generated on Tue Jul 12 2022 13:55:42 by
