lights FAQ Forum

Data Structures
lfrb WIP


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 mmaped mirror buffers.

API -> 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:Lua+ffi
Version: dev-4-g4209c3f
Last commit:
License: Public Domain
Requires: +luajit 
Required by: