diff --git a/crate/process/src/processor.rs b/crate/process/src/processor.rs index 9083dad..2117528 100644 --- a/crate/process/src/processor.rs +++ b/crate/process/src/processor.rs @@ -176,7 +176,7 @@ impl Processor_ { to.status = Status::Running; self.scheduler.remove(pid); - info!("switch from {} to {} {:x?}", pid0, pid, to.context); + //info!("switch from {} to {} {:x?}", pid0, pid, to.context); unsafe { from.context.switch(&mut to.context); } } diff --git a/crate/sync/src/main.rs b/crate/sync/src/main.rs index 49c86fa..0837505 100644 --- a/crate/sync/src/main.rs +++ b/crate/sync/src/main.rs @@ -1,3 +1,5 @@ +//! entrance to test the communication in processes with solving five philosophers problem + mod mutex; mod monitor; diff --git a/crate/sync/src/monitor.rs b/crate/sync/src/monitor.rs index 2c7cb8d..b984fbc 100644 --- a/crate/sync/src/monitor.rs +++ b/crate/sync/src/monitor.rs @@ -1,3 +1,5 @@ +//! solve the five philosophers problem with monitor + use std::thread; use std::sync::{Mutex, Condvar, Arc}; use std::time::Duration; @@ -51,6 +53,7 @@ struct Table { fork_condvar: Vec, } +// the main function to test pub fn main() { let table = Arc::new(Table { fork_status: Mutex::new(vec![false; 5]), diff --git a/crate/sync/src/mutex.rs b/crate/sync/src/mutex.rs index 06b3223..eeef0f4 100644 --- a/crate/sync/src/mutex.rs +++ b/crate/sync/src/mutex.rs @@ -1,3 +1,5 @@ +//! solve the five philosophers problem with mutex + use std::thread; use std::sync::{Mutex, Arc}; use std::time::Duration; @@ -35,6 +37,7 @@ struct Table { forks: Vec>, } +// the main function to test pub fn main() { let table = Arc::new(Table { forks: vec![