typeover
rust curriculum

Curriculum Production Rust Threads and channels exercise 2 · mcq

Threads and channels

After let handle = thread::spawn(...), how do you BLOCK until the spawned thread finishes and get its return value?

TypeScript reference
Pick the idiomatic Go translation

About this theme

Rust's ownership rules extend into concurrency. This theme covers thread::spawn, move closures, JoinHandle, message passing with channels, and shared state with Arc<Mutex<T>>. Planned exercises: 1. choose move for spawned threads. 2. recognise join. 3. choose a channel for message passing. 4. fill thread::spawn. 5. fill Arc::clone. 6. write a thread that returns a value. 7. write a channel sender and receiver. 8. translate TS async-looking work into threaded Rust. 9. fix shared mutable state with Arc<Mutex<_>>.