lights FAQ Forum   github.com/luapower/lfrb
lfrb

Multi-threading
lanes
luastate
pthread
thread
lfrb

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 mmaped 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: 2 years ago | Edit on GitHub

Pkg type:Lua+ffi
Version: dev-2-g3d2a7d7
Last commit:
License: PD
Requires: +luajit 
Required by:

Top