Loading tutorials
move, and how to call thread::spawn and join. It explains why the obvious ways of sharing a counter between threads fail. The rest of the tutorial builds the fix.2 min readmove, and thread::spawn with JoinHandle. It covers how Arc lets several threads own the same value. Locking and mutation come in later chapters.3 min readthread::spawn with JoinHandle. You should also be able to read a compiler error. The chapter explains the compile-time check that stops you from sharing data across threads unsafely.2 min readmove, and thread::spawn with JoinHandle. You should also be comfortable with Result and unwrap. Here we look at Mutex<T> on its own. Sharing it across threads with Arc comes in the next chapters.2 min readDrop, and how Mutex::new and lock() are called. It explains what lock() returns and when the lock is released.2 min readmove closures, thread::spawn with JoinHandle, and Result with unwrap. Earlier chapters covered Arc for shared ownership and Mutex for mutual exclusion. Here you combine them.2 min readVec with Arc<Mutex<T>>. It also assumes you know that lock() returns a guard that unlocks when it is dropped.2 min readArc<Mutex<T>>, lock guards and how thread::spawn and JoinHandle::join report panics. Here you will see what happens when a thread panics while it holds a lock, and how to respond on purpose.3 min readArc<Mutex<T>>, how a MutexGuard releases its lock when dropped, and how to spawn and join threads.2 min readArc<Mutex<T>>, lock guards, and thread::spawn with move closures. It covers RwLock, which lets many threads read shared data at the same time.2 min readArc, Mutex and thread::spawn with move closures from the earlier chapters.2 min readmove closures, and thread::spawn with JoinHandle. It also assumes you have used Arc<Mutex<T>> to share state.2 min readArc<Mutex<T>>, lock guards, and thread::spawn with move closures. It covers how one thread waits until another thread changes shared state, without spinning.2 min readArc<Mutex<T>>, lock guards, thread::spawn and move closures. It also assumes you have met RwLock, atomics and scoped threads from earlier chapters. Here you will choose between them and message passing.2 min read