Files
100-exercises-to-learn-rust/book/src/07_threads/00_intro.md
2026-06-15 09:44:11 +02:00

681 B
Raw Blame History

Threads

One of Rusts big promises is fearless concurrency: making it easier to write safe, concurrent programs. We havent seen much of that yet. All the work weve done so far has been single-threaded. Time to change that!

In this chapter well make our ticket store multithreaded.
Well have the opportunity to touch most of Rusts core concurrency features, including:

  • Threads, using the std::thread module
  • Message passing, using channels
  • Shared state, using Arc, Mutex and RwLock
  • Send and Sync, the traits that encode Rusts concurrency guarantees

Well also discuss various design patterns for multithreaded systems and some of their trade-offs.