Fix exceptions with semaphore
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user