PriorityQueue - Rust #004 - Blocking Dequeue
This video is in French.
In this video, we continue building our concurrent Priority Queue. This time we add a blocking version of the dequeue() method and handle controlled shutdown with shutdown_immediate().
Topics covered
- Why
try_dequeue()is not sufficient (the polling problem) - Designing a blocking
dequeue()method withCondvar - The wait predicate
(!pq.is_empty()) || closed - Handling spurious wakeups
- The mutation-then-notification order for safe behavior
- Implementing a clean and consistent immediate shutdown (
shutdown_immediate)
An important step before introducing graceful shutdowns and timeouts 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