Skip to content

Commit ad717d1

Browse files
committed
---
yaml --- r: 156463 b: refs/heads/snap-stage3 c: 66939df h: refs/heads/master i: 156461: 1e1735b 156459: 15713c1 156455: 5a042e6 156447: 8908eaa v: v3
1 parent 30bd6d0 commit ad717d1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c29a7520e7fb4a5b4d4eccfc594e05793ef6688d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e1389530cf5dca112f5d282acfa7f08a08e114bc
4+
refs/heads/snap-stage3: 66939dfe645a2eaf2ba9a2750122836a37271db1
55
refs/heads/try: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/doc/intro.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -444,19 +444,19 @@ It gives us this error:
444444
It mentions that "numbers moved into closure environment". Because we referred
445445
to `numbers` inside of our `proc`, and we create three `proc`s, we would have
446446
three references. Rust detects this and gives us the error: we claim that
447-
`numbers` has ownership, but our code tries to make ten owners. This may cause
448-
a safety problem, so Rust disallows it.
447+
`numbers` has ownership, but our code tries to make three owners. This may
448+
cause a safety problem, so Rust disallows it.
449449

450450
What to do here? Rust has two types that helps us: `Arc<T>` and `Mutex<T>`.
451451
"Arc" stands for "atomically reference counted." In other words, an Arc will
452452
keep track of the number of references to something, and not free the
453453
associated resource until the count is zero. The 'atomic' portion refers to an
454454
Arc's usage of concurrency primitives to atomically update the count, making it
455-
safe across threads. If we use an Arc, we can have our ten references. But, an
456-
Arc does not allow mutable borrows of the data it holds, and we want to modify
457-
what we're sharing. In this case, we can use a `Mutex<T>` inside of our Arc. A
458-
Mutex will synchronize our accesses, so that we can ensure that our mutation
459-
doesn't cause a data race.
455+
safe across threads. If we use an Arc, we can have our three references. But,
456+
an Arc does not allow mutable borrows of the data it holds, and we want to
457+
modify what we're sharing. In this case, we can use a `Mutex<T>` inside of our
458+
Arc. A Mutex will synchronize our accesses, so that we can ensure that our
459+
mutation doesn't cause a data race.
460460

461461
Here's what using an Arc with a Mutex looks like:
462462

0 commit comments

Comments
 (0)