Merge remote-tracking branch 'origin/thread_scheduler' into thread_scheduler

# Conflicts:
#	src/kernel/synch.rs
This commit is contained in:
Rémi Rativel
2023-03-13 23:41:20 +01:00
27 changed files with 628 additions and 62 deletions

View File

@@ -111,7 +111,7 @@ impl<'t> Lock<'_> {
pub fn release(&mut self, machine: &mut Machine, scheduler: &mut Scheduler, current_thread: Rc<RefCell<Thread>>) {
let old_status = machine.interrupt.set_status(InterruptOff);
if self.held_by_current_thread(current_thread) {
if self.is_held_by_current_thread(current_thread) {
if self.waiting_queue.peek() != None {
self.owner = self.waiting_queue.pop().unwrap();
scheduler.ready_to_run(Rc::clone(&self.owner));
@@ -123,7 +123,7 @@ impl<'t> Lock<'_> {
machine.interrupt.set_status(old_status);
}
pub fn held_by_current_thread(&mut self, current_thread: Rc<RefCell<Thread>>) -> bool {
pub fn is_held_by_current_thread(&mut self, current_thread: Rc<RefCell<Thread>>) -> bool {
Rc::ptr_eq(&self.owner, &current_thread)
}
}