pub struct Scheduler { /* private fields */ }Expand description
Scheduler state.
Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(policy: SchedPolicy) -> Self
pub fn new(policy: SchedPolicy) -> Self
Create a scheduler with the given policy.
Sourcepub fn mark_blocked(&mut self, coro_id: usize, reason: BlockReason)
pub fn mark_blocked(&mut self, coro_id: usize, reason: BlockReason)
Mark a coroutine as blocked.
§impl Scheduler
impl Scheduler
pub fn schedule(&mut self) -> Option<usize>
pub fn schedule(&mut self) -> Option<usize>
Pick the next coroutine to execute, or None if none are ready.
pub fn schedule_with<F>(&mut self, has_progress: F) -> Option<usize>
pub fn schedule_with<F>(&mut self, has_progress: F) -> Option<usize>
Pick the next coroutine using a progress predicate.
pub fn pick_runnable<F>(&mut self, has_progress: F) -> Option<usize>
pub fn pick_runnable<F>(&mut self, has_progress: F) -> Option<usize>
Lean-aligned scheduler pick entrypoint.
pub fn pick_eligible_runnable<F>(&mut self, has_progress: F) -> Option<usize>
pub fn pick_eligible_runnable<F>(&mut self, has_progress: F) -> Option<usize>
Pick the next runnable coroutine restricted to cached ready eligibility.
pub fn update_after_step(&mut self, coro_id: usize, update: StepUpdate)
pub fn update_after_step(&mut self, coro_id: usize, update: StepUpdate)
Lean-aligned scheduler state transition helper.
pub fn reschedule(&mut self, coro_id: usize)
pub fn reschedule(&mut self, coro_id: usize)
Re-enqueue a coroutine that yielded or completed an instruction.
pub fn is_ready(&self, coro_id: usize) -> bool
pub fn is_ready(&self, coro_id: usize) -> bool
Return whether a coroutine is currently in the global ready set.
pub fn ready_count(&self) -> usize
pub fn ready_count(&self) -> usize
Number of ready coroutines.
pub fn ready_snapshot(&self) -> Vec<usize>
pub fn ready_snapshot(&self) -> Vec<usize>
Snapshot of the current global ready queue order.
pub fn ready_set_snapshot(&self) -> BTreeSet<usize>
pub fn ready_set_snapshot(&self) -> BTreeSet<usize>
Snapshot of current ready coroutine IDs as a set.
pub fn any_ready<F>(&self, predicate: F) -> bool
pub fn any_ready<F>(&self, predicate: F) -> bool
Return whether any ready coroutine satisfies predicate.
pub fn blocked_count(&self) -> usize
pub fn blocked_count(&self) -> usize
Number of blocked coroutines.
pub fn is_stuck(&self) -> bool
pub fn is_stuck(&self) -> bool
Whether all coroutines are either done or blocked (no progress possible).
pub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Total steps executed.
pub fn policy(&self) -> &SchedPolicy
pub fn policy(&self) -> &SchedPolicy
Current policy.
pub fn block_reason(&self, coro_id: usize) -> Option<&BlockReason>
pub fn block_reason(&self, coro_id: usize) -> Option<&BlockReason>
Get the block reason for a coroutine, if blocked.
pub fn blocked_ids(&self) -> Vec<usize>
pub fn blocked_ids(&self) -> Vec<usize>
All blocked coroutine IDs.
pub fn blocked_snapshot(&self) -> BTreeMap<usize, BlockReason>
pub fn blocked_snapshot(&self) -> BTreeMap<usize, BlockReason>
Snapshot of blocked coroutine reasons.
pub fn has_eligible_ready(&self) -> bool
pub fn has_eligible_ready(&self) -> bool
Whether any coroutine is currently cached as both ready and eligible.
pub fn set_ready_eligibility(
&mut self,
coro_id: usize,
eligibility: ReadyEligibility,
)
pub fn set_ready_eligibility( &mut self, coro_id: usize, eligibility: ReadyEligibility, )
Update cached ready eligibility for a coroutine.
pub fn clear_ready_eligibility(&mut self)
pub fn clear_ready_eligibility(&mut self)
Clear all cached ready eligibility state.
pub fn assign_lane(&mut self, coro_id: usize, lane: LaneId)
pub fn assign_lane(&mut self, coro_id: usize, lane: LaneId)
Assign a coroutine to a specific lane.
pub fn lane_queues_snapshot(&self) -> BTreeMap<LaneId, Vec<usize>>
pub fn lane_queues_snapshot(&self) -> BTreeMap<LaneId, Vec<usize>>
Snapshot of per-lane ready queues.
pub fn lane_blocked_snapshot(
&self,
) -> BTreeMap<LaneId, BTreeMap<usize, BlockReason>>
pub fn lane_blocked_snapshot( &self, ) -> BTreeMap<LaneId, BTreeMap<usize, BlockReason>>
Snapshot of per-lane blocked coroutines.
pub fn record_cross_lane_handoff(
&mut self,
from_coro: usize,
to_coro: usize,
reason: impl Into<String>,
)
pub fn record_cross_lane_handoff( &mut self, from_coro: usize, to_coro: usize, reason: impl Into<String>, )
Record a cross-lane handoff.
pub fn cross_lane_handoffs(&self) -> &[CrossLaneHandoff]
pub fn cross_lane_handoffs(&self) -> &[CrossLaneHandoff]
Cross-lane handoff log.