diff --git a/Cargo.toml b/Cargo.toml index f1127f8..719bb82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ cfg-if = "1.0" spinlock = { git = "https://github.com/Starry-OS/spinlock.git" } axtask = { git = "https://github.com/Starry-OS/axtask.git" } axhal = {git = "https://github.com/Starry-OS/axhal.git"} +kernel_guard = { git = "https://github.com/Starry-OS/kernel_guard.git" } [dev-dependencies] rand = "0.8" diff --git a/src/completion.rs b/src/completion.rs index eb4d522..3a297c5 100644 --- a/src/completion.rs +++ b/src/completion.rs @@ -17,9 +17,10 @@ use alloc::sync::Arc; use axtask::{WaitTaskList, WaitTaskNode}; use spinlock::SpinNoIrq; -use axtask::schedule; -#[cfg(feature = "irq")] -use axtask::schedule_timeout; + +use axtask::current_processor; +use kernel_guard::NoPreemptIrqSave; + #[cfg(feature = "irq")] use core::time::Duration; @@ -74,7 +75,7 @@ impl Completion { if inner.done == 0 { inner.queue.prepare_to_wait(waiter.clone()); drop(inner); - schedule(); + current_processor::().reschedule(); } else { inner.done -= 1; break; @@ -93,7 +94,7 @@ impl Completion { if inner.done == 0 { inner.queue.prepare_to_wait(waiter.clone()); drop(inner); - if schedule_timeout(deadline) { + if current_processor::().schedule_timeout(deadline) { break true; } } else {