diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-06-09 17:24:44 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-06-09 17:24:44 -0400 |
| commit | b38e9a73d429924fd3557411b2ebcb532a4cea81 (patch) | |
| tree | 3118999d0f4e1369f5386fe540a62b1f77f85c5a | |
| parent | d16906283afe2ecac5258af5ba3926009ecf831f (diff) | |
| parent | e12c4205220a6e1114493aa4501cc04e48d8693b (diff) | |
Rollup merge of #26136 - steveklabnik:gh25597, r=alexcrichton
Fixes #25597
| -rw-r--r-- | src/doc/trpl/dining-philosophers.md | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/doc/trpl/dining-philosophers.md b/src/doc/trpl/dining-philosophers.md index a18d9bb442d..b24d50c890d 100644 --- a/src/doc/trpl/dining-philosophers.md +++ b/src/doc/trpl/dining-philosophers.md @@ -674,9 +674,13 @@ let handles: Vec<_> = philosophers.into_iter().map(|p| { Finally, inside of our `map()`/`collect()` loop, we call `table.clone()`. The `clone()` method on `Arc<T>` is what bumps up the reference count, and when it -goes out of scope, it decrements the count. You’ll notice we can introduce a -new binding to `table` here, and it will shadow the old one. This is often used -so that you don’t need to come up with two unique names. +goes out of scope, it decrements the count. This is needed so that we know how +many references to `table` exist across our threads. If we didn’t have a count, +we wouldn’t know how to deallocate it. + +You’ll notice we can introduce a new binding to `table` here, and it will +shadow the old one. This is often used so that you don’t need to come up with +two unique names. With this, our program works! Only two philosophers can eat at any one time, and so you’ll get some output like this: |
