mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
Improve the comment of arc1
This commit is contained in:
parent
b4f4c79ac4
commit
dec6772b05
|
@ -1,4 +1,4 @@
|
||||||
// In this exercise, we are given a `Vec` of u32 called `numbers` with values
|
// In this exercise, we are given a `Vec` of `u32` called `numbers` with values
|
||||||
// ranging from 0 to 99. We would like to use this set of numbers within 8
|
// ranging from 0 to 99. We would like to use this set of numbers within 8
|
||||||
// different threads simultaneously. Each thread is going to get the sum of
|
// different threads simultaneously. Each thread is going to get the sum of
|
||||||
// every eighth value with an offset.
|
// every eighth value with an offset.
|
||||||
|
@ -9,8 +9,11 @@
|
||||||
// …
|
// …
|
||||||
// The eighth thread (offset 7), will sum 7, 15, 23, …
|
// The eighth thread (offset 7), will sum 7, 15, 23, …
|
||||||
//
|
//
|
||||||
// Because we are using threads, our values need to be thread-safe. Therefore,
|
// Each thread should own a reference-counting pointer to the vector of
|
||||||
// we are using `Arc`.
|
// numbers. But `Rc` isn't thread-safe. Therefore, we need to use `Arc`.
|
||||||
|
//
|
||||||
|
// Don't get distracted by how threads are spawned and joined. We will practice
|
||||||
|
// that later in the exercises about threads.
|
||||||
|
|
||||||
// Don't change the lines below.
|
// Don't change the lines below.
|
||||||
#![forbid(unused_imports)]
|
#![forbid(unused_imports)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// In this exercise, we are given a `Vec` of u32 called `numbers` with values
|
// In this exercise, we are given a `Vec` of `u32` called `numbers` with values
|
||||||
// ranging from 0 to 99. We would like to use this set of numbers within 8
|
// ranging from 0 to 99. We would like to use this set of numbers within 8
|
||||||
// different threads simultaneously. Each thread is going to get the sum of
|
// different threads simultaneously. Each thread is going to get the sum of
|
||||||
// every eighth value with an offset.
|
// every eighth value with an offset.
|
||||||
|
@ -9,8 +9,11 @@
|
||||||
// …
|
// …
|
||||||
// The eighth thread (offset 7), will sum 7, 15, 23, …
|
// The eighth thread (offset 7), will sum 7, 15, 23, …
|
||||||
//
|
//
|
||||||
// Because we are using threads, our values need to be thread-safe. Therefore,
|
// Each thread should own a reference-counting pointer to the vector of
|
||||||
// we are using `Arc`.
|
// numbers. But `Rc` isn't thread-safe. Therefore, we need to use `Arc`.
|
||||||
|
//
|
||||||
|
// Don't get distracted by how threads are spawned and joined. We will practice
|
||||||
|
// that later in the exercises about threads.
|
||||||
|
|
||||||
// Don't change the lines below.
|
// Don't change the lines below.
|
||||||
#![forbid(unused_imports)]
|
#![forbid(unused_imports)]
|
||||||
|
|
Loading…
Reference in a new issue