pub trait SchedulerControl {
// Required methods
fn pending_tasks(&self) -> usize;
fn active_workers(&self) -> usize;
fn worker_count(&self) -> usize;
fn has_work(&self) -> bool;
fn join(&self) -> ExecutorResult<()>;
fn shutdown(&self);
fn metrics(&self) -> ScheduleMetrics;
}Expand description
Introspect and control a scheduler’s lifecycle.
Required Methods§
Sourcefn pending_tasks(&self) -> usize
fn pending_tasks(&self) -> usize
Number of queued-but-not-yet-running jobs.
Sourcefn active_workers(&self) -> usize
fn active_workers(&self) -> usize
Number of jobs currently executing.
Sourcefn worker_count(&self) -> usize
fn worker_count(&self) -> usize
Number of worker threads.
Sourcefn join(&self) -> ExecutorResult<()>
fn join(&self) -> ExecutorResult<()>
Block until the scheduler is quiescent (no queued or running work).
§Errors
Returns an ExecutorError if the
scheduler cannot reach quiescence.
Sourcefn shutdown(&self)
fn shutdown(&self)
Drain queued work and stop the worker sets.
Exactly one non-worker caller joins the worker sets. Other external callers wait for that join. Scheduler workers close the blocking lane and return before the election; when no external caller remains, worker ownership releases the scheduler after every accepted task drains.
Sourcefn metrics(&self) -> ScheduleMetrics
fn metrics(&self) -> ScheduleMetrics
Snapshot the scheduler metrics.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".