erl_lfq is a lock-free, single-producer, single-consumer FIFO queue for Erlang binaries, implemented in C++ and wrapped in a NIF.
Information on building and installing Erlang/OTP can be found here (more info).
erl_lfq uses gcc-specific atomic builtins, so building requires a relatively recent gcc/g++.
$ git clone git://github.com/argv0/erl_lfq.git
$ cd erl_lfq
$ make
$ make test
erl_lfq:new() -> {ok, QRef}
: create a new queue
erl_lfq:in(QRef, binary()) -> ok
: add an item to the queue
erl_lfq:out(QRef) -> binary() | empty
: remove the next item from the queue
erl_lfq:byte_size(QRef) -> non_neg_integer()
: total size in bytes of items in the queue
erl_lfq:len(QRef) -> non_neg_integer()
: number of items in the queue
Use one topic branch per pull request.
Do not commit to master in your fork.
Provide a clean branch without any merge commits from upstream.
Usually you should squash any intermediate commits into the original single commit.
Do not introduce trailing whitespace.
Do not mix spaces and tabs.
Do not introduce lines longer than 80 characters.
erlang-mode (emacs) indentation is preferred. vi-only users are encouraged to give Vim emulation (more info) a try.
Structure your commit message like this:
One line summary (less than 50 characters) Longer description (wrap at 72 characters)
- Less than 50 characters
- What was changed
- Imperative present tense (fix, add, change)
Fix bug 123
Add 'foobar' command
Change default timeout to 123
- No period
- Wrap at 72 characters
- Why, explain intention and implementation approach
- Present tense
- Break up logical changes
- Make whitespace changes separately