Cleanup of clippy warnings
This commit is contained in:
parent
fe519555cc
commit
5c66577989
@ -37,7 +37,9 @@ pub struct ThreadManager {
|
|||||||
pub g_alive: List<Rc<RefCell<Thread>>>,
|
pub g_alive: List<Rc<RefCell<Thread>>>,
|
||||||
/// Thread in ready state waiting to become active
|
/// Thread in ready state waiting to become active
|
||||||
ready_list: List<Rc<RefCell<Thread>>>,
|
ready_list: List<Rc<RefCell<Thread>>>,
|
||||||
|
/// List of objects created by the thread manager (such as Locks and Semaphores)
|
||||||
obj_addrs: ObjAddr,
|
obj_addrs: ObjAddr,
|
||||||
|
/// If true, enables debug mode
|
||||||
debug: bool
|
debug: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +161,7 @@ impl ThreadManager {
|
|||||||
/// Finish the execution of the thread and prepare its deallocation
|
/// Finish the execution of the thread and prepare its deallocation
|
||||||
pub fn thread_finish(&mut self, machine: &mut Machine, thread: Rc<RefCell<Thread>>) {
|
pub fn thread_finish(&mut self, machine: &mut Machine, thread: Rc<RefCell<Thread>>) {
|
||||||
let old_status = machine.interrupt.set_status(InterruptStatus::InterruptOff);
|
let old_status = machine.interrupt.set_status(InterruptStatus::InterruptOff);
|
||||||
assert_eq!(self.g_alive.remove(Rc::clone(&thread)), true);
|
assert!(self.g_alive.remove(Rc::clone(&thread)));
|
||||||
self.debug(format!("Sleeping thread {}", thread.borrow().get_name()));
|
self.debug(format!("Sleeping thread {}", thread.borrow().get_name()));
|
||||||
// g_objets_addrs->removeObject(self.thread) // a ajouté plus tard
|
// g_objets_addrs->removeObject(self.thread) // a ajouté plus tard
|
||||||
self.thread_sleep(machine, Rc::clone(&thread));
|
self.thread_sleep(machine, Rc::clone(&thread));
|
||||||
@ -233,9 +235,8 @@ impl ThreadManager {
|
|||||||
};
|
};
|
||||||
let old_status = machine.interrupt.set_status(InterruptStatus::InterruptOff);
|
let old_status = machine.interrupt.set_status(InterruptStatus::InterruptOff);
|
||||||
sema.counter += 1;
|
sema.counter += 1;
|
||||||
match sema.waiting_queue.pop() {
|
if let Some(thread) = sema.waiting_queue.pop() {
|
||||||
Some(thread) => self.ready_to_run(thread),
|
self.ready_to_run(thread)
|
||||||
None => ()
|
|
||||||
}
|
}
|
||||||
machine.interrupt.set_status(old_status);
|
machine.interrupt.set_status(old_status);
|
||||||
Ok(MachineOk::Ok)
|
Ok(MachineOk::Ok)
|
||||||
@ -317,10 +318,12 @@ impl ThreadManager {
|
|||||||
self.g_current_thread = thread
|
self.g_current_thread = thread
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a mutable reference to the ObjAddr field of this thread_manager
|
||||||
pub fn get_obj_addrs(&mut self) -> &mut ObjAddr {
|
pub fn get_obj_addrs(&mut self) -> &mut ObjAddr {
|
||||||
&mut self.obj_addrs
|
&mut self.obj_addrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Prints debug messages if self.debug is set to true.
|
||||||
fn debug(&self, message: String) {
|
fn debug(&self, message: String) {
|
||||||
if self.debug {
|
if self.debug {
|
||||||
println!("{}", message);
|
println!("{}", message);
|
||||||
|
Loading…
Reference in New Issue
Block a user