threading

Arc and Mutex for safe shared mutable state across threads

When you need shared mutable state across threads, Arc<Mutex<T>> is the idiomatic pattern. Arc is an atomic reference counter that allows multiple ownership, and Mutex provides interior mutability with runtime locking. You clone the Arc fo