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§
Sourcefn schedule_thread(
&mut self,
thread: ForeignBox<Thread<K>>,
reason: RescheduleReason,
)
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).
Sourcefn pop_next_thread(&mut self) -> Option<ForeignBox<Thread<K>>>
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".