mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 14:33:56 +00:00
Use CpuId
with validity ensurance rather than u32
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
b400d287fa
commit
3468ec213b
@ -13,7 +13,12 @@ use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use spin::Once;
|
||||
|
||||
use super::{preempt::cpu_local, processor, Task};
|
||||
use crate::{cpu::PinCurrentCpu, prelude::*, task::disable_preempt, timer};
|
||||
use crate::{
|
||||
cpu::{CpuId, PinCurrentCpu},
|
||||
prelude::*,
|
||||
task::disable_preempt,
|
||||
timer,
|
||||
};
|
||||
|
||||
/// Injects a scheduler implementation into framework.
|
||||
///
|
||||
@ -40,7 +45,7 @@ pub trait Scheduler<T = Task>: Sync + Send {
|
||||
///
|
||||
/// If the `current` of a CPU needs to be preempted, this method returns the id of
|
||||
/// that CPU.
|
||||
fn enqueue(&self, runnable: Arc<T>, flags: EnqueueFlags) -> Option<u32>;
|
||||
fn enqueue(&self, runnable: Arc<T>, flags: EnqueueFlags) -> Option<CpuId>;
|
||||
|
||||
/// Gets an immutable access to the local runqueue of the current CPU core.
|
||||
fn local_rq_with(&self, f: &mut dyn FnMut(&dyn LocalRunQueue<T>));
|
||||
|
Reference in New Issue
Block a user