Optimized to avoid cloning heap values

This commit is contained in:
François Autin 2023-04-05 13:34:06 +02:00
parent 8b3a3bebe7
commit 69f91170f6
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

@ -65,16 +65,12 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
match call_type { match call_type {
SC_SHUTDOWN => Ok(MachineOk::Shutdown), SC_SHUTDOWN => Ok(MachineOk::Shutdown),
SC_EXIT => { SC_EXIT => {
match &system.get_thread_manager().g_current_thread { let th = match &system.get_thread_manager().g_current_thread {
Some(th) => { Some(th) => th,
let th = Rc::clone(th); None => Err("Current thread is None".into())
system.get_thread_manager().thread_finish(machine, th); }?;
Ok(MachineOk::Ok) system.get_thread_manager().thread_finish(machine, th);
}, Ok(MachineOk::Ok)
None => {
Err("Current thread is None".into())
}
}
}, },
SC_EXEC => todo!(), SC_EXEC => todo!(),
SC_JOIN => todo!(), SC_JOIN => todo!(),