Fix exceptions with semaphore
This commit is contained in:
@@ -7,12 +7,13 @@ use std::rc::Rc;
|
||||
use super::thread_manager::ThreadManager;
|
||||
|
||||
/// Structure of a Semaphore used for synchronisation
|
||||
#[derive(PartialEq)]
|
||||
pub struct Semaphore {
|
||||
|
||||
/// Counter of simultanous Semaphore
|
||||
counter:i32,
|
||||
pub counter:i32,
|
||||
/// QUeue of Semaphore waiting to be exucated
|
||||
waiting_queue:List<Rc<RefCell<Thread>>>,
|
||||
pub waiting_queue:List<Rc<RefCell<Thread>>>,
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +79,8 @@ impl Semaphore {
|
||||
/// Lock used for synchronisation, can be interpreted has a Semaphore with a
|
||||
/// counter of 1
|
||||
/// It's used for critical parts
|
||||
pub struct Lock{
|
||||
#[derive(PartialEq)]
|
||||
pub struct Lock {
|
||||
|
||||
/// Thread owning the lock
|
||||
owner: Option<Rc<RefCell<Thread>>>,
|
||||
|
||||
Reference in New Issue
Block a user