For this exercise check out the Dining Philosophers example and the chapter Concurrency of the Rust Book.