![]() |
RaidZeroLib
Coroutine robot framework for VEX V5
|
The single-threaded tick loop that drives every coroutine. More...
#include <Runtime.hpp>
Classes | |
| struct | Config |
Public Member Functions | |
| Runtime (Platform &platform) | |
| Runtime (Platform &platform, Config config) | |
| ~Runtime () | |
| Runtime (const Runtime &)=delete | |
| Runtime & | operator= (const Runtime &)=delete |
| template<class Awaitable> | |
| decltype(auto) | run (Awaitable &&task) |
| Runs task on this runtime until it completes and returns its result. | |
| Time | now () const noexcept |
| Time at the start of the current tick. | |
| Duration | dt () const noexcept |
| Time between the start of the previous tick and this one. | |
| std::uint64_t | tickCount () const noexcept |
| Number of ticks started so far (0 before the first tick). | |
| Duration | period () const noexcept |
| CompetitionMode | competitionMode () const |
| The competition mode field control is in right now. | |
Static Public Member Functions | |
| static Runtime & | current () |
| The runtime that exists right now. Only one can exist at a time. | |
| static Runtime * | tryCurrent () noexcept |
| The current runtime, or nullptr if none exists (e.g. while globals are being constructed). | |
| static std::uint64_t | globalTickId () noexcept |
| Identifies the current tick uniquely across every runtime there has been; never repeats. Use it as the key for per-tick caches (a new runtime restarts tickCount() at 0). | |
Friends | |
| class | TickAwaiter |
| class | SleepAwaiter |
| struct | corral::EventLoopTraits< Runtime > |
The single-threaded tick loop that drives every coroutine.
Each tick, in order: resume TickStarted waiters, SensorsUpdated waiters, expired timers, EstimatorsUpdated waiters, then ComponentsUpdated waiters, then sleep until the next period. Within a stage, waiters resume in the order they started waiting, so loops that wait once per tick keep their order from tick to tick. A coroutine that waits again while its stage is being resumed lands in the next tick, so no loop can run twice in one tick.
It is corral's event loop: runtime.run(task) runs task to completion.
|
inlineexplicit |
| rz::Runtime::~Runtime | ( | ) |
|
delete |
|
inlinenodiscard |
The competition mode field control is in right now.
|
staticnodiscard |
The runtime that exists right now. Only one can exist at a time.
|
inlinenodiscardnoexcept |
Time between the start of the previous tick and this one.
|
inlinestaticnodiscardnoexcept |
Identifies the current tick uniquely across every runtime there has been; never repeats. Use it as the key for per-tick caches (a new runtime restarts tickCount() at 0).
|
inlinenodiscardnoexcept |
| decltype(auto) rz::Runtime::run | ( | Awaitable && | task | ) |
Runs task on this runtime until it completes and returns its result.
|
inlinenodiscardnoexcept |
Number of ticks started so far (0 before the first tick).
|
inlinestaticnodiscardnoexcept |
The current runtime, or nullptr if none exists (e.g. while globals are being constructed).
|
friend |
|
friend |
|
friend |