From 91f5c6054cad550fb07bb37eecf71d45d05dd20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 5 Apr 2023 16:12:15 +0200 Subject: [PATCH] Added trait SynchObj to relevant structs --- src/kernel/synch.rs | 7 +++++++ src/utility/objaddr.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kernel/synch.rs b/src/kernel/synch.rs index 5a9eb93..b3a52f0 100644 --- a/src/kernel/synch.rs +++ b/src/kernel/synch.rs @@ -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. diff --git a/src/utility/objaddr.rs b/src/utility/objaddr.rs index d876056..c402f5d 100644 --- a/src/utility/objaddr.rs +++ b/src/utility/objaddr.rs @@ -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 }