Fix exceptions with semaphore

This commit is contained in:
Quentin Legot
2023-04-12 14:49:08 +02:00
parent 134e2bd2cc
commit 21f3a72a3d
5 changed files with 64 additions and 25 deletions

View File

@ -15,6 +15,7 @@ use crate::kernel::synch::{ Semaphore, Lock };
/// A method allows to detect of an object corresponding to a given
/// identifier exists; this is used to check the parameters of system
/// calls.
#[derive(PartialEq)]
pub struct ObjAddr {
last_id: i32,
semaphores: HashMap<i32, Semaphore>,
@ -47,12 +48,12 @@ impl ObjAddr {
}
/// Searches for a semaphore of id **id** in self
pub fn search_semaphore(&self, id: i32) -> Option<&mut Semaphore> {
pub fn search_semaphore(&mut self, id: i32) -> Option<&mut Semaphore> {
self.semaphores.get_mut(&id)
}
/// Searches for a lock of id **id** in self
pub fn search_lock(&self, id:i32) -> Option<&mut Lock> {
pub fn search_lock(&mut self, id:i32) -> Option<&mut Lock> {
self.locks.get_mut(&id)
}