pub struct PeriodicTask {
pub period_us: u64,
pub budget_us: u64,
pub priority: Priority,
/* private fields */
}Expand description
Periodic task specification
A task may carry a run function pointer that is invoked by
RateMonotonicScheduler::schedule when the task becomes ready. Tasks
created without a runner (via PeriodicTask::new) only advance their
period bookkeeping when scheduled; use PeriodicTask::with_runner or
RateMonotonicScheduler::schedule_with to run real work.
Fields§
§period_us: u64Period in microseconds
budget_us: u64Execution time budget in microseconds
priority: PriorityPriority
Implementations§
Source§impl PeriodicTask
impl PeriodicTask
Sourcepub const fn new(period_us: u64, budget_us: u64, priority: Priority) -> Self
pub const fn new(period_us: u64, budget_us: u64, priority: Priority) -> Self
Create a new periodic task without an attached runner
When scheduled, such a task only advances its period bookkeeping and
records a zero-duration execution. Attach work with
PeriodicTask::with_runner or drive execution through
RateMonotonicScheduler::schedule_with.
Sourcepub const fn with_runner(
period_us: u64,
budget_us: u64,
priority: Priority,
run: fn(),
) -> Self
pub const fn with_runner( period_us: u64, budget_us: u64, priority: Priority, run: fn(), ) -> Self
Create a new periodic task with an attached runner function
The run function is executed by RateMonotonicScheduler::schedule
each time the task becomes ready, and its wall-clock duration is
recorded in the task statistics (including deadline-miss detection
against budget_us).
Sourcepub fn mark_executed(&mut self, current_us: u64)
pub fn mark_executed(&mut self, current_us: u64)
Mark task as executed
Sourcepub fn next_deadline(&self) -> Deadline
pub fn next_deadline(&self) -> Deadline
Get deadline for next execution
Trait Implementations§
Source§impl Clone for PeriodicTask
impl Clone for PeriodicTask
Source§fn clone(&self) -> PeriodicTask
fn clone(&self) -> PeriodicTask
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more