#include <modm/processing/fiber/scheduler.hpp>
|
static void | run () |
| Runs the currently active scheduler.
|
|
|
void | runNext (Task *task) |
|
void | runLast (Task *task) |
|
Task * | removeCurrent () |
|
bool | empty () const |
|
void | jump (Task &other) |
|
void | yield () |
|
void | unschedule () |
|
void | add (Task &task) |
|
bool | start () |
|
|
static Scheduler & | instance () |
| Returns the currently active scheduler.
|
|
|
Task * | last {nullptr} |
|
Task * | current {nullptr} |
|
The scheduler executes fibers in a simple round-robin fashion. Fibers can be added to a scheduler using the modm::fiber::Task::start()
function, also while the scheduler is running. Fibers returning from their function will automatically unschedule themselves.
Calls into the currently active scheduler to jump to the next fiber. Local control flow resumes by returning from this function.
- Note
- If called while no scheduler is active, or only one fiber is currently running, this function returns immediately without performing a jump. This can cause deadlocks if the calling fiber waits on progress made outside of it.
- Warning
- Be careful to yield inside long running loops or when busy-waiting. These are cooperative fibers, so the scheduler will not preempt fibers, and you may starve other fibers of processing time. If you cannot guarantee correct timings, consider using an RTOS.
The documentation for this class was generated from the following file: