Document that SegQueue is not completely lock free
Author: matkladCreated Mar 17, 2021Updated Mar 5, 2026
Labelsdocscrossbeam-queue
SegQueue is not completely lock-free. It effectively contains a spin-lock inside. While this shouldn't affect performance in most cases, it can cause pathological behavior with priority inversion (see this post for details). I am not expert enough to judge if this the right trade-off or not, but I think this warrants a note in the docs
Note that my understanding is very superficial and based on
- https://github.com/crossbeam-rs/crossbeam/pull/279#issuecomment-450490718
- http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
and very cursory look at the source code.
Source: crossbeam-rs/crossbeam