Added trait SynchObj to relevant structs
This commit is contained in:
parent
586c077002
commit
91f5c6054c
@ -1,4 +1,5 @@
|
||||
use crate::utility::list::List;
|
||||
use crate::utility::objaddr::*;
|
||||
use crate::kernel::thread::Thread;
|
||||
use crate::simulator::interrupt::InterruptStatus::InterruptOff;
|
||||
use crate::simulator::machine::Machine;
|
||||
@ -16,6 +17,8 @@ pub struct Semaphore {
|
||||
|
||||
}
|
||||
|
||||
impl SynchObj for Semaphore {}
|
||||
|
||||
impl Semaphore {
|
||||
|
||||
/// Initializes a semaphore, so that it can be used for synchronization.
|
||||
@ -89,6 +92,8 @@ pub struct Lock{
|
||||
|
||||
}
|
||||
|
||||
impl SynchObj for Lock {}
|
||||
|
||||
impl Lock {
|
||||
|
||||
/// Initialize a Lock, so that it can be used for synchronization.
|
||||
@ -193,6 +198,8 @@ pub struct Condition{
|
||||
|
||||
}
|
||||
|
||||
impl SynchObj for Condition {}
|
||||
|
||||
impl Condition {
|
||||
|
||||
/// Initializes a Condition, so that it can be used for synchronization.
|
||||
|
@ -15,7 +15,7 @@ pub trait SynchObj { }
|
||||
/// A method allows to detect of an object corresponding to a given
|
||||
/// identifier exists; this is used to check the parameters of system
|
||||
/// calls.
|
||||
struct ObjAddr<'a> {
|
||||
pub struct ObjAddr<'a> {
|
||||
last_id: i32,
|
||||
map: HashMap<i32, &'a dyn SynchObj>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user