modm API documentation
|
#include <modm/processing/fiber/task.hpp>
Public Member Functions | |
template<size_t Size, class T > | |
Task (Stack< Size > &stack, T &&closure, Start start=Start::Now) | |
void | watermark_stack () |
size_t | stack_usage () const |
bool | stack_overflow () const |
bool | start () |
bool | isRunning () const |
Friends | |
class | Scheduler |
The fiber task connects the callable fiber object with the fiber context and scheduler. It constructs the fiber function on the stack if necessary, and adds the contexts to the scheduler. If the fiber function returns, the task is removed from the scheduler. Tasks can then be restarted, which will call the fiber function from the beginning again
Note that a task contains no stack, only the control structures necessary for managing a fiber. You may therefore place objects of this class in fast core-local memory, while the stack must remain in DMA-able memory!
modm::fiber::Task::Task | ( | Stack< Size > & | stack, |
T && | closure, | ||
Start | start = Start::Now |
||
) |
stack | A stack object that is NOT shared with other tasks. |
closure | A callable object of signature void(*)() . |
start | When to start this task. |
|
inline |
|
inline |
modm_context_stack_overflow()
.
|
inline |
modm_context_stack_usage()
. bool modm::fiber::Task::start | ( | ) |
Adds the task to the currently active scheduler, if not already running.
|
inline |
Watermarks the stack to measure stack_usage()
later.
modm_context_watermark()
.