Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. SchedulerAlgorithmInterface

SchedulerAlgorithmInterface

Trait SchedulerAlgorithmInterface 

Source
pub trait SchedulerAlgorithmInterface<K: Kernel>:
    'static
    + Send
    + Sync {
    // Required methods
    fn schedule_thread(
        &mut self,
        thread: ForeignBox<Thread<K>>,
        reason: RescheduleReason,
    );
    fn pop_next_thread(&mut self) -> Option<ForeignBox<Thread<K>>>;
}
Expand description

Common interface implemented by scheduling algorithm backends.

Backends are embedded in the kernel’s static scheduler state and accessed from any core under the scheduler lock (hence 'static + Send + Sync). All methods are called with that lock held; implementations must not take additional locks or block.

Required Methods§

Source

fn schedule_thread( &mut self, thread: ForeignBox<Thread<K>>, reason: RescheduleReason, )

Takes ownership of thread and makes it eligible to run.

reason is a placement hint describing why the thread is being enqueued (e.g. preempted threads may be placed ahead of peers of equal priority).

Source

fn pop_next_thread(&mut self) -> Option<ForeignBox<Thread<K>>>

Removes and returns the highest-priority ready thread, or None if no thread is ready.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§