Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.28 KB

README.md

File metadata and controls

32 lines (23 loc) · 1.28 KB

spsc_ring

a single producer single customer lock-free (atomic) queue, initially write for a async logging module

lock-free single producer single consumer ring buffer (bounded)

It's simple to implement a lock free SPSC ring buffer for there won't be any contention. But there are some details need to be handled to implement correctly and with high efficiency.

NOTICE: This implementation is modeled after Intel DPDK::rte_ring and Linux kernel::kfifo

design documentation of DPDK::rte_ring:

feature:

  • use malloc and in-place constructor, free + in-place destructor to support non-POD types,
  • emplace
  • support batch dequeue

further improvement: use atomic instead of volatile + memory fence

testing:

make test