From d70de26f026b376675dd449328a0d83489d44360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rativel?= Date: Tue, 14 Mar 2023 14:45:19 +0100 Subject: [PATCH] Structure documentation --- src/kernel/synch.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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>, }