PQRST
1.0
Priority Queue for Running Simple Tasks
|
#include <inttypes.h>
Go to the source code of this file.
Classes | |
class | Task |
A Task represents a block of code to be executed at some point in the future. More... | |
class | MaintenanceTask |
There are a few ‘maintenance tasks’ on the queue, placed there by the queueing system. More... | |
class | LoopTask |
A Task which will automatically reschedule itself after it is run. More... | |
class | FunctionTask |
A task which runs a supplied function at a given time. More... | |
class | TaskQueue |
A priority queue of Tasks. More... | |
Macros | |
#define | MS_FMT "%u" |
A printf format specifier which provides the correct spec for a value of type ms_t. More... | |
Typedefs | |
typedef uint32_t | ms_t |
The Arduino supports a time type of unsigned long , which is a 4-byte unsigned integer on that platform. More... | |
typedef void(* | run_task_t) (ms_t t) |
The type of the function which can be supplied to a FunctionTask. More... | |
typedef void(* | traverse_queue_cb_t) (ms_t due, const char *ident, const Task *T) |
The type of the callback for TaskQueue::traverse_queue. More... | |
Variables | |
TaskQueue | Queue |
The global TaskQueue. More... | |
#define MS_FMT "%u" |
A printf format specifier which provides the correct spec for a value of type ms_t.
typedef uint32_t ms_t |
The Arduino supports a time type of unsigned long
, which is a 4-byte unsigned integer on that platform.
We stick with that size here, for convenience, and refer to it as ms_t
. Note that, although this is referred to as ‘milliseconds’ here and elsewhere in this documentation, this can in practice be any 32-bit time value: millis()
or micros()
or any other jiffies that may be convenient, as long as the times given to the various push/run methods, and as long as the time given to TaskQueue::run_ready are in consistent units.
typedef void(* run_task_t) (ms_t t) |
The type of the function which can be supplied to a FunctionTask.
When the task is ready, the function is called with the current reference time as argument – the function should typically not call millis()
or micros()
.
the | reference time |
The type of the callback for TaskQueue::traverse_queue.
If PQRST_TASK_IDENT
is false, then this has two arguments, giving the due time and a pointer to the Task; if the define is true, then it has three arguments, where the second is the task identifier. The type of the callback passed to the TaskQueue::traverse_queue method. This is called once for each task in the queue.
due | the current time |
ident | the identification string of the task |
T | the task |