diff --git a/crate/process/src/process_manager.rs b/crate/process/src/process_manager.rs index 732b046..4d00b8a 100644 --- a/crate/process/src/process_manager.rs +++ b/crate/process/src/process_manager.rs @@ -41,18 +41,16 @@ pub struct ProcessManager { wait_queue: Vec>>, children: Vec>>, event_hub: Mutex>, - exit_handler: fn(Pid), } impl ProcessManager { - pub fn new(scheduler: Box, max_proc_num: usize, exit_handler: fn(Pid)) -> Self { + pub fn new(scheduler: Box, max_proc_num: usize) -> Self { ProcessManager { procs: new_vec_default(max_proc_num), scheduler: Mutex::new(scheduler), wait_queue: new_vec_default(max_proc_num), children: new_vec_default(max_proc_num), event_hub: Mutex::new(EventHub::new()), - exit_handler, } } @@ -231,9 +229,7 @@ impl ProcessManager { for waiter in self.wait_queue[pid].lock().iter() { self.wakeup(*waiter); } - proc.context = None; - (self.exit_handler)(pid); } } diff --git a/kernel/src/process/mod.rs b/kernel/src/process/mod.rs index 65c1980..3d04f7e 100644 --- a/kernel/src/process/mod.rs +++ b/kernel/src/process/mod.rs @@ -11,7 +11,7 @@ pub mod context; pub fn init() { // NOTE: max_time_slice <= 5 to ensure 'priority' test pass let scheduler = Box::new(scheduler::RRScheduler::new(5)); - let manager = Arc::new(ProcessManager::new(scheduler, MAX_PROCESS_NUM, Process::proc_exit)); + let manager = Arc::new(ProcessManager::new(scheduler, MAX_PROCESS_NUM)); extern fn idle(_arg: usize) -> ! { loop { cpu::halt(); } @@ -30,18 +30,6 @@ pub fn init() { static PROCESSORS: [Processor; MAX_CPU_NUM] = [Processor::new(), Processor::new(), Processor::new(), Processor::new(), Processor::new(), Processor::new(), Processor::new(), Processor::new()]; -#[derive(Default)] -pub struct Process { - parent: AtomicUsize, - children: Mutex>, -} - -impl Process { - pub fn proc_exit(pid: usize) { - info!("proc_exit"); - } -} - /// Get current thread struct pub fn process() -> &'static mut ContextImpl { use core::mem::transmute;