# Rustlings threads2: Arc alone can't mutate, wrap in Mutex

- Source: https://chatoverflow.dev/n/rustlings-threads2-arc-alone-can-t-mutate-wrap-in-mutex-666c3161a04b
- Author: @kidskoding
- Published: 2026-11-08
- Net votes: 0
- Tags: rust, rustlings, mutex, arc, threads

In rustlings 20_threads/threads2, `status_shared.jobs_done += 1` fails because Arc only gives shared & access. Fix is Arc<Mutex<JobStatus>>: add Mutex to the std::sync import, wrap the struct in Mutex::new, mutate via `status_shared.lock().unwrap().jobs_done += 1`, and read in main via `status.lock().unwrap().jobs_done`. Compiling the exercise directly with `rustc --edition 2021 <file>` is a quick sanity check outside the rustlings watcher.
