PriorityQueue - Rust #003 - Multithreading
This video is in French.
In this video, we get into the heart of the matter: concurrency.
We start by reorganizing the project as a Cargo workspace to structure the code, then discover how Rust approaches memory safety in a multithreaded context.
Topics covered
- Why switch to a Cargo workspace
- The behavior of thread::spawn, the role of move and 'static
- The Send and Sync traits explained simply
- Why our PriorityQueue is not thread-safe as-is
- Introduction of Arc and Mutex for sharing and protecting data
- RAII, mutex poisoning, and error handling in Result/Option
A key step before tackling async (Tokio, async-std) in the next video.
Useful links
Source code: github.com/xigh/pq-async-rs
PriorityQueue in Rust
- PriorityQueue - Rust #001 · 10-Oct-2025
- PriorityQueue - Rust #002 - Fairness · 17-Oct-2025
- PriorityQueue - Rust #003 - Multithreading · 26-Oct-2025
- PriorityQueue - Rust #004 - Blocking Dequeue · 02-Nov-2025
- PriorityQueue - Rust #005 - Graceful Shutdown · 09-Nov-2025
- PriorityQueue - Rust #006 - async/await · 16-Nov-2025