add_task->wakeup_task
This commit is contained in:
parent
274a7c0eb2
commit
24e40f3722
6 changed files with 17 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
use super::{ProcessControlBlock, TaskControlBlock};
|
||||
use super::{ProcessControlBlock, TaskControlBlock, TaskStatus};
|
||||
use crate::sync::UPIntrFreeCell;
|
||||
use alloc::collections::{BTreeMap, VecDeque};
|
||||
use alloc::sync::Arc;
|
||||
|
@ -34,6 +34,13 @@ pub fn add_task(task: Arc<TaskControlBlock>) {
|
|||
TASK_MANAGER.exclusive_access().add(task);
|
||||
}
|
||||
|
||||
pub fn wakeup_task(task: Arc<TaskControlBlock>) {
|
||||
let mut task_inner = task.inner_exclusive_access();
|
||||
task_inner.task_status = TaskStatus::Ready;
|
||||
drop(task_inner);
|
||||
add_task(task);
|
||||
}
|
||||
|
||||
pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
|
||||
TASK_MANAGER.exclusive_access().fetch()
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use switch::__switch;
|
|||
|
||||
pub use context::TaskContext;
|
||||
pub use id::{kstack_alloc, pid_alloc, KernelStack, PidHandle, IDLE_PID};
|
||||
pub use manager::{add_task, pid2process, remove_from_pid2process};
|
||||
pub use manager::{add_task, wakeup_task, pid2process, remove_from_pid2process};
|
||||
pub use processor::{
|
||||
current_kstack_top, current_process, current_task, current_trap_cx, current_trap_cx_user_va,
|
||||
current_user_token, run_tasks, schedule, take_current_task,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue