This repo is a very partial (pull requests welcome) re-implementation of the rust crate crossbeam.
Only the following types are implemented:
xbeam.queue.ArrayQueue
- a bounded MPMC queue that allocates a fixed-capacity buffer on construction.xbeam.queue.ArrayQueueNoAlloc
- an implementation ofArrayQueue
that does not allocate.
-
xbeam.utils.Backoff
- for exponential backoff in spin loops. -
xbeam.utils.CACHE_LINE_LENGTH
- replacement for the rustCachePadded
, used like this:var aligned: usize align(xbeam.utils.CACHE_LINE_LENGTH) = 0;
Download the repo somehow then either:
-
To
build.zig
add:exe.addPackagePath("xbeam", "zig-xbeam/src/index.zig"); // or whatever the path is
-
Then the package is available within any zig file:
const xbeam = @import("xbeam");
In any zig file add:
const xbeam = @import("../zig-xbeam/src/index.zig"); // or whatever the path is from *that* file