
Concurrency
Arc Mutex in Rust and the Pattern Behind Shared State
Arc gives several threads shared ownership and Mutex gives them one-at-a-time access. See the full pattern, the deadlock to avoid and what poisoning means.
9 min read
Tag
2 posts

Arc gives several threads shared ownership and Mutex gives them one-at-a-time access. See the full pattern, the deadlock to avoid and what poisoning means.

Share state in async code with Arc<Mutex<T>>, with a state owning task and channels, or with read heavy structures. See the trade-offs and the failure modes.