/enlfq

Erlang NIF lock-free Queue

Primary LanguageC++Apache License 2.0Apache-2.0

enlfq

A simple NIF lock-free Queue using the library: moodycamel::concurrentqueue

moodycamel::ConcurrentQueue

An industrial-strength lock-free queue for C++.

Features:

  • Knock-your-socks-off blazing fast performance.
  • Single-header implementation. Just drop it in your project.
  • Fully thread-safe lock-free queue. Use concurrently from any number of threads.
  • C++11 implementation -- elements are moved (instead of copied) where possible.
  • Templated, obviating the need to deal exclusively with pointers -- memory is managed for you.
  • No artificial limitations on element types or maximum count.
  • Memory can be allocated once up-front, or dynamically as needed.
  • Fully portable (no assembly; all is done through standard C++11 primitives).
  • Supports super-fast bulk operations.
  • Includes a low-overhead blocking version (BlockingConcurrentQueue).
  • Exception safe.

Build

$ rebar3 compile

Using

    {ok, Q} = enlfq:new().

    T =  {any, term, [], #{}, 1}.

    true = enlfq:push(Q,T).

    {ok, T} = enlfq:pop(Q).

    empty = enlfq:pop(Q).