Skip to content

Commit 9e9593a

Browse files
committed
---
yaml --- r: 138383 b: refs/heads/master c: 66939df h: refs/heads/master i: 138381: fc06bfc 138379: 9905378 138375: 5101045 138367: d93dcae v: v3
1 parent 6fb2f0b commit 9e9593a

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,5 +1,5 @@
11
---
2-
refs/heads/master: e1389530cf5dca112f5d282acfa7f08a08e114bc
2+
refs/heads/master: 66939dfe645a2eaf2ba9a2750122836a37271db1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5

trunk/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)