1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-19 22:19:29 +02:00
Pavel Roskin fbc6be4e1c
Actually protect against deadlock in Dining Philosophers async exercise (#1772)
Swapping forks for one philosopher feels like cheating. It's like one of
the philosophers is facing away from the table. Or perhaps it's the only
right-handed philosopher at the table.

More importantly, there is no effective mechanism to prevent deadlocks.
Add that mechanism, it's useful for learning Rust.

The new code demonstrates let-else, drop and returning values from a
loop. `std::mem::swap` remains in the thread version of the Dining
Philosophers exercise for now.

This also fixes compilation. `left_fork` and `right_fork` had to be
`mut` in `main()` for the workaround to compile.
2024-01-30 20:00:19 -05:00
..
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00
2023-11-29 16:39:24 +01:00

Course Content

The files in this directory make up the content of the course. The files here can include third-party content from ../third_party/ as well.

When we publish a translation of the course, we git restore the src/ and third_party/ directories at the repository root back to the date listed in the POT-Creation-Date header of the translation. It is crucial, that all translatable content lives in those two directories. The other files (such as book.toml and theme/) are not restored and we always use the latest version of them.