8000 Merge pull request #211 from Manishearth/quantum · killercup/blog.rust-lang.org@02d594f · GitHub
[go: up one dir, main page]

Skip to content

Commit 02d594f

Browse files
authored
Merge pull request rust-lang#211 from Manishearth/quantum
Explain what an Arc is
2 parents d0153c1 + eccdd62 commit 02d594f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

_posts/2017-11-14-Fearless-Concurrency-In-Firefox-Quantum.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Computed styles are grouped into “style structs” of related properties, e.g.
4141
font properties, one for all the background properties, and so on. Now, most of these are shared;
4242
for example, the font of a child element is usually the same as its parent, and often sibling
4343
elements share styles even if they don’t have the same style as the parent. Stylo uses Rust’s
44-
`Arc<T>` to share style structs between elements. `Arc<T>` makes its contents immutable, so it’s
45-
thread safe — you can’t accidentally modify a style struct when there’s a chance it is being used by
46-
other elements.
44+
atomically reference counted [`Arc<T>`][arc] to share style structs between elements. `Arc<T>`
45+
makes its contents immutable, so it’s thread safe — you can’t accidentally modify a style struct
46+
when there’s a chance it is being used by other elements.
4747

4848
We supplement this immutable access with `Arc::make_mut()`; for example, [this line][font-mutate]
4949
calls `.mutate_font()` (a thin wrapper around `Arc::make_mut()` for the font style struct) to set
@@ -147,4 +147,5 @@ Experience the benefits of Rust yourself — try out [Firefox Quantum][quantum]!
147147
[talk-rbr]: https://www.joshmatthews.net/rbr17
148148
[font-mutate]: https://github.com/servo/servo/blob/657b2339a1e68f3a9c4525f35db023d3f149ffac/components/style/values/computed/font.rs#L182
149149
[inherited-style]: https://github.com/servo/servo/blob/657b2339a1e68f3a9c4525f35db023d3f149ffac/components/style/properties/properties.mako.rs#L2623-L2627
150+
[arc]: https://doc.rust-lang.org/std/sync/struct.Arc.html
150151

0 commit comments

Comments
 (0)
0