mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-26 15:24:17 -05:00
Merge pull request #1236 from mvanschellebeeck/main
style: explicitly use Arc::clone
This commit is contained in:
commit
572dd2e9f3
2 changed files with 3 additions and 3 deletions
|
@ -17,7 +17,7 @@ fn main() {
|
||||||
let status = Arc::new(JobStatus { jobs_completed: 0 });
|
let status = Arc::new(JobStatus { jobs_completed: 0 });
|
||||||
let mut handles = vec![];
|
let mut handles = vec![];
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
let status_shared = status.clone();
|
let status_shared = Arc::clone(&status);
|
||||||
let handle = thread::spawn(move || {
|
let handle = thread::spawn(move || {
|
||||||
thread::sleep(Duration::from_millis(250));
|
thread::sleep(Duration::from_millis(250));
|
||||||
// TODO: You must take an action before you update a shared value
|
// TODO: You must take an action before you update a shared value
|
||||||
|
|
|
@ -26,8 +26,8 @@ impl Queue {
|
||||||
|
|
||||||
fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
|
fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
|
||||||
let qc = Arc::new(q);
|
let qc = Arc::new(q);
|
||||||
let qc1 = qc.clone();
|
let qc1 = Arc::clone(&qc);
|
||||||
let qc2 = qc.clone();
|
let qc2 = Arc::clone(&qc);
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
for val in &qc1.first_half {
|
for val in &qc1.first_half {
|
||||||
|
|
Loading…
Reference in a new issue