Structure documentation
This commit is contained in:
parent
08f684ccce
commit
d70de26f02
@ -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<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>>
|
||||
|
||||
}
|
||||
|
||||
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<RefCell<Thread>>,
|
||||
/// The queue of threads waiting for execution
|
||||
waiting_queue:List<Rc<RefCell<Thread>>>,
|
||||
/// Thread manager which managing threads
|
||||
thread_manager: Rc<RefCell<ThreadManager>>,
|
||||
/// 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<Rc<RefCell<Thread>>>,
|
||||
/// Thread manager which managing threads
|
||||
thread_manager: Rc<RefCell<ThreadManager>>,
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user