Skip to content

Commit

Permalink
Add speaker notes to some concurrency pages (#2501)
Browse files Browse the repository at this point in the history
Part of #1083.
  • Loading branch information
djmitche authored Dec 6, 2024
1 parent e0fa410 commit 380dc3c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/concurrency/channels/bounded.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fn main() {
- Calling `send()` will block the current thread until there is space in the
channel for the new message. The thread can be blocked indefinitely if there
is nobody who reads from the channel.
- A call to `send()` will abort with an error (that is why it returns `Result`)
if the channel is closed. A channel is closed when the receiver is dropped.
- Like unbounded channels, a call to `send()` will abort with an error if the
channel is closed.
- A bounded channel with a size of zero is called a "rendezvous channel". Every
send will block the current thread until another thread calls [`recv()`].

Expand Down
9 changes: 9 additions & 0 deletions src/concurrency/channels/unbounded.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ fn main() {
```

[`mpsc::channel()`]: https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html

<details>

- An unbounded channel will allocate as much space as is necessary to store
pending messages. The `send()` method will not block the calling thread.
- A call to `send()` will abort with an error (that is why it returns `Result`)
if the channel is closed. A channel is closed when the receiver is dropped.

</details>
9 changes: 9 additions & 0 deletions src/concurrency/sync-exercises/dining-philosophers.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ name = "dining-philosophers"
version = "0.1.0"
edition = "2021"
```

<details>

- Encourage students to focus first on implementing a solution that "mostly"
works.
- The deadlock in the simplest solution is a general concurrency problem and
highlights that Rust does not automatically prevent this sort of bug.

</details>
9 changes: 9 additions & 0 deletions src/concurrency/sync-exercises/link-checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ cargo run
`www.google.org` domain. Put an upper limit of 100 pages or so so that you
don't end up being blocked by the site.

<details>

- This is a complex exercise and intended to give students an opportunity to
work on a larger project than others. A success condition for this exercise is
to get stuck on some "real" issue and work through it with the support of
other students or the instructor.

</details>

[1]: https://docs.rs/reqwest/
[2]: https://docs.rs/scraper/
[3]: https://docs.rs/thiserror/

0 comments on commit 380dc3c

Please sign in to comment.