Merge branch 'thread_scheduler' of gitlab.istic.univ-rennes1.fr:simpleos/burritos into thread_scheduler

This commit is contained in:
François Autin 2023-03-14 14:50:02 +01:00
commit 81f3ac2099
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

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