diff --git a/src/kernel/synch.rs b/src/kernel/synch.rs index d4e349c..e7b9ac2 100644 --- a/src/kernel/synch.rs +++ b/src/kernel/synch.rs @@ -12,13 +12,16 @@ 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> } -impl<'t> Semaphore { +impl Semaphore { /// Decrement the value, and wait if it becomes < 0. Checking the /// value and decrementing must be done atomically, so we @@ -65,9 +68,13 @@ impl<'t> 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>, }