Fix start_thread
This commit is contained in:
committed by
François Autin
parent
6820086579
commit
0c3af96b78
@ -28,7 +28,7 @@ impl<'a> ThreadManager<'a> {
|
||||
}
|
||||
|
||||
/// Start a thread, attaching it to a process
|
||||
pub fn start_thread(&mut self, thread: &mut Thread, owner: Process, func_pc: i64, argument: i64) -> Result<(), ErrorCode> {
|
||||
pub fn start_thread(&mut self, mut thread: Thread, owner: Process, func_pc: i64, argument: i64) -> Result<(), ErrorCode> {
|
||||
thread.process = Option::Some(owner);
|
||||
let ptr = 0; // todo addrspace
|
||||
thread.init_thread_context(func_pc, ptr, argument);
|
||||
@ -36,8 +36,8 @@ impl<'a> ThreadManager<'a> {
|
||||
thread.init_simulator_context(base_stack_addr);
|
||||
thread.process.as_mut().unwrap().num_thread += 1;
|
||||
let thread_m = Rc::new(thread);
|
||||
// self.get_g_alive().push(Rc::clone(thread));
|
||||
// self.g_scheduler().ready_to_run(Rc::clone(&thread));
|
||||
self.get_g_alive().push(Rc::clone(&thread_m));
|
||||
self.g_scheduler().ready_to_run(Rc::clone(&thread_m));
|
||||
Result::Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user