@ -1,3 +1,5 @@
//! entrance to test the communication in processes with solving five philosophers problem
mod mutex;
mod monitor;
//! 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<Condvar>,
}
// the main function to test
pub fn main() {
let table = Arc::new(Table {
fork_status: Mutex::new(vec![false; 5]),
//! solve the five philosophers problem with mutex
use std::sync::{Mutex, Arc};
@ -35,6 +37,7 @@ struct Table {
forks: Vec<Mutex<()>>,
forks: vec![