diff --git a/src/kernel/synch.rs b/src/kernel/synch.rs index ec1ba90..e7b9ac2 100644 --- a/src/kernel/synch.rs +++ b/src/kernel/synch.rs @@ -12,9 +12,12 @@ use super::thread_manager::ThreadManager; /// Structure of a Semaphore used for synchronisation pub struct Semaphore { + /// Counter of simultanous Semaphore counter:i32, + /// QUeue of Semaphore waiting to be exucated waiting_queue:List>>, - thread_manager: Rc> // On s'assure que le tm vit plus longtemps que les semaphore avec le lifetime + /// Thread manager which managing threads + thread_manager: Rc> } @@ -65,9 +68,13 @@ impl Semaphore { /// It's used for critical parts pub struct Lock{ + /// Thread owning the lock owner: Rc>, + /// The queue of threads waiting for execution waiting_queue:List>>, + /// Thread manager which managing threads thread_manager: Rc>, + /// A boolean definig if the lock is free or not free: bool } @@ -131,7 +138,9 @@ impl Lock { /// Structure of a condition used for synchronisation pub struct Condition{ + /// The queue of threads waiting for execution waiting_queue:List>>, + /// Thread manager which managing threads thread_manager: Rc>, }