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
TaskBase Class Reference
[TaskBase class]
#include <TaskBase.h>
Inherits LinkEntry.
Inherited by Task< R()>, Task< R(A0)>, and Task< R(A0, A1)>.
Public Member Functions | |
TaskBase (TaskQueue *q) | |
Construct a new TaskBase object. | |
virtual | ~TaskBase () |
Destroy this TaskBase. | |
void | set (TaskQueue *q) |
Set the queue of this task. | |
void | cancel () |
Cancel the execution of this task. | |
bool | ready () |
Return true if this task is ready to be posted. | |
void | wait () |
Wait for this task to finish execution. | |
bool | finished () |
Check if the callback has run to completion or been fully canceled. | |
Protected Member Functions | |
virtual uint32_t | size ()=0 |
Size of buffer required for TaskBase::start. | |
virtual run_callback_t | start (void *data, uint32_t size)=0 |
Copy any callback data and return a callback to run. | |
virtual void | finish () |
Inform this task that execution has finished. | |
void | post () |
Post this task to the set TaskQueue for execution. |
Detailed Description
Representation of a caller allocated task
Definition at line 43 of file TaskBase.h.
Constructor & Destructor Documentation
Member Function Documentation
void cancel | ( | ) |
Cancel the execution of this task.
Once cancelled the task can be posted again. Previous calls to post may still run. If you need to ensure the callback has finished the function wait() can be used.
- Note:
- This function is interrupt safe
virtual void finish | ( | ) | [protected, virtual] |
Inform this task that execution has finished.
bool finished | ( | ) |
Check if the callback has run to completion or been fully canceled.
When an task is finished the queue is completely done with it and the callback is either fully complete or has been canceled and will not run.
- Returns:
- true if this task has been flushed from the queue, false otherwise
void post | ( | ) | [protected] |
Post this task to the set TaskQueue for execution.
bool ready | ( | ) |
Return true if this task is ready to be posted.
Check if this task is on a queue waiting to be run.
- Returns:
- true if it is safe to call post
virtual uint32_t size | ( | ) | [protected, pure virtual] |
Size of buffer required for TaskBase::start.
- Returns:
- requested buffer size
Implemented in Task< R(A0, A1)>.
virtual run_callback_t start | ( | void * | data, |
uint32_t | size | ||
) | [protected, pure virtual] |
Copy any callback data and return a callback to run.
- Parameters:
-
data Buffer to copy data to. Do not copy more than TaskBase::size() data. size Maximum size to copy
Implemented in Task< R(A0, A1)>.
void wait | ( | ) |
Wait for this task to finish execution.
When this function returns then this task is in the finished state.
Generated on Tue Jul 12 2022 13:55:42 by
