mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-01 19:20:59 +02:00
This is to be used in the QUIC code, where the multiple producers are the listener threads, and the single consumer is the datagram handler thread. Entries are variable-length with a size header, and are kept contiguous in the buffer, so padding is inserted at the end when an entry would otherwise wrap around. The size field is overloaded to also mark padding (-1) and entries that are still free or not yet ready for reads (0). Headers and payloads are aligned on 8 bytes. Aligning on 16 bytes might be beneficial on some architectures to let memcpy() use 128-bit SIMD instructions. The head and tail offsets are 64-bit unsigned integers, making ABA issues from integer overflow impossible on current or near-future hardware. Reservation uses a CAS rather than FAA because of the need to insert padding to keep entries contiguous.