lights FAQ Forum github.com/luapower/lfrb
lfrb

Data Structures
heap
linkedlist
lrucache
lfrb WIP

lfrb

Lock-free ring buffer


Work in progress

local lfrb = require'lfrb'

Lock-free ring buffer. Maintains two indices which can be advanced separately from two different threads. It doesn't hold the actual buffer. Best used with [mmap]ed mirror buffers.

API


lfrb.new(capacity) -> rb create a new ring buffer state rb.capacity -> n ring buffer's capacity rb.write_index() -> i get current write index rb.advance_write_index(n) advance the write index by n elements rb.read_index() -> i get current read index `rb.


Last updated: 3 years ago | Edit on GitHub

Pkg type:C
Version: dev-5-gcae28b6
Last commit:
License: Public Domain
Requires:
Required by:

Top