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

This commit is contained in:
Samy Solhi
2023-03-22 15:00:27 +01:00
4 changed files with 196 additions and 99 deletions

View File

@ -27,7 +27,7 @@ impl Semaphore {
/// - *counter* initial value of counter
/// - *thread_manager* Thread manager which managing threads
pub fn new(counter: i32) -> Semaphore{
Semaphore { counter, waiting_queue: List::new()}
Semaphore { counter, waiting_queue: List::default() }
}
/// Decrement the value, and wait if it becomes < 0. Checking the
@ -99,7 +99,7 @@ impl Lock {
/// ### Parameters
/// - **thread_manager** Thread manager which managing threads
pub fn new() -> Lock {
Lock { owner: None, waiting_queue: List::new(), free: true }
Lock { owner: None, waiting_queue: List::default(), free: true }
}
/// Wait until the lock become free. Checking the
@ -197,7 +197,7 @@ impl Condition {
/// ### Parameters
/// - *thread_manager* Thread manager which managing threads
pub fn new() -> Condition {
Condition{ waiting_queue: List::new()}
Condition{ waiting_queue: List::default()}
}
/// Block the calling thread (put it in the wait queue).

View File

@ -28,8 +28,8 @@ impl ThreadManager {
Self {
g_current_thread: Option::None,
g_thread_to_be_destroyed: Option::None,
g_alive: List::new(),
ready_list: List::new(),
g_alive: List::default(),
ready_list: List::default(),
}
}