Skip to content

Latest commit

聽

History

History
65 lines (49 loc) 路 3.39 KB

File metadata and controls

65 lines (49 loc) 路 3.39 KB

lockfreequeues (Compatibility Facade)

Important

Package Consolidated into lockfree
As of version 5.1.0, lockfreequeues and nim-debra have been unified into a single high-performance library: lockfree.
This repository is maintained strictly as a zero-overhead backwards-compatibility facade mapping historical types to canonical lockfree engines.
All new projects and active development should depend directly on lockfree.

Docs Migration Guide License: MIT


What is this package?

lockfreequeues continues to exist on Nimble so that existing projects do not break. Under the hood, version 5.1.0+ forwards all calls directly to the unified lockfree engine:

# Existing code continues to compile with zero changes:
import lockfreequeues

var q = newSipsicQueue[int, 16]()
discard q.push(42)
assert q.pop().get == 42

Legacy API Mapping

All historical types, constructors, and endpoints are 100% supported:

Legacy Type Parameters Modern lockfree Equivalent
Sipsic[N, T] Capacity N, Type T BQueue[T, ccSingle, ccSingle, N, 0, 0] (newSpscQueue)
Mupsic[N, P, T] Capacity N, Producers P, Type T BQueue[T, ccMulti, ccSingle, N, P, 0] (newMpscQueue)
Sipmuc[N, C, T] Capacity N, Consumers C, Type T BQueue[T, ccSingle, ccMulti, N, 0, C] (newSpmcQueue)
Mupmuc[N, P, C, T] Capacity N, Producers P, Consumers C, Type T BQueue[T, ccMulti, ccMulti, N, P, C] (newMpmcQueue)
UnboundedSipsic[T, ST, S] Type T, Strategy ST, Segment S Queue[T, ccSingle, ccSingle, ST, S, 1]
UnboundedMupsic[T, ST, S, M] Type T, Strategy ST, Segment S, MaxThreads M Queue[T, ccMulti, ccSingle, ST, S, M]
UnboundedSipmuc[T, ST, S, M] Type T, Strategy ST, Segment S, MaxThreads M Queue[T, ccSingle, ccMulti, ST, S, M]
UnboundedMupmuc[T, ST, S, M] Type T, Strategy ST, Segment S, MaxThreads M Queue[T, ccMulti, ccMulti, ST, S, M]

Upgrading to lockfree

To take advantage of modern features (CSP Channel[T] facade, cross-language C ABI, Apple Silicon cacheline tuning, and batch pop primitives), migrate your dependency in .nimble:

# In your .nimble file:
requires "lockfree >= 0.1.0"
# In your code:
import lockfree
import lockfree/channel

var chan = newBoundedChannel[int](64)
assert chan.send(42)

Read the full Migration Guide and Documentation.