Skip to content

a single producer single customer lock-free (atomic) queue

Notifications You must be signed in to change notification settings

rzbdz/spsc_ring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a single producer single customer lock-free (atomic) queue

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published