VOOZH about

URL: https://www.nuget.org/packages/Soenneker.Queues.Intrusive.Mpsc/

⇱ NuGet Gallery | Soenneker.Queues.Intrusive.Mpsc 4.0.22




👁 Image
Soenneker.Queues.Intrusive.Mpsc 4.0.22

Prefix Reserved
dotnet add package Soenneker.Queues.Intrusive.Mpsc --version 4.0.22
 
 
NuGet\Install-Package Soenneker.Queues.Intrusive.Mpsc -Version 4.0.22
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Queues.Intrusive.Mpsc" Version="4.0.22" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Queues.Intrusive.Mpsc" Version="4.0.22" />
 
Directory.Packages.props
<PackageReference Include="Soenneker.Queues.Intrusive.Mpsc" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Queues.Intrusive.Mpsc --version 4.0.22
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Queues.Intrusive.Mpsc, 4.0.22"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Queues.Intrusive.Mpsc@4.0.22
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Queues.Intrusive.Mpsc&version=4.0.22
 
Install as a Cake Addin
#tool nuget:?package=Soenneker.Queues.Intrusive.Mpsc&version=4.0.22
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image

👁 alternate text is missing from this package README image
Soenneker.Queues.Intrusive.Mpsc

High-performance intrusive multi-producer / single-consumer (MPSC) queue primitive.

This package provides a lock-free, allocation-free MPSC queue designed for low-level concurrency primitives and async infrastructure. It is intended for advanced usage where control over memory layout, allocation, and synchronization semantics is required.


Installation

dotnet add package Soenneker.Queues.Intrusive.Mpsc

Overview

IntrusiveMpscQueue<TNode> implements a classic MPSC algorithm using a permanent sentinel (stub) node:

  • Multiple producer threads may enqueue concurrently.
  • Exactly one consumer thread may dequeue.
  • Each enqueue performs a single atomic operation.
  • No allocations are performed by the queue itself.
  • Node linkage is stored directly on the node (intrusive).

This design is well suited for wait queues, schedulers, async locks, and similar primitives.


Usage

Define a node type

Nodes must implement IIntrusiveNode<TNode> or derive from IntrusiveNode<TNode>.

public sealed class WorkItem : IntrusiveNode<WorkItem>
{
 public int Id;
}

Create a queue with a permanent stub

var stub = new WorkItem();
var queue = new IntrusiveMpscQueue<WorkItem>(stub);

Enqueue (multi-producer)

queue.Enqueue(new WorkItem { Id = 42 });

Dequeue (single-consumer)

if (queue.TryDequeue(out var item))
{
 // process item
}

If stronger dequeue semantics are required (for example, when a producer has advanced the tail but not yet published the link), use TryDequeueSpin.


Correctness and constraints

  • Exactly one consumer thread is supported.
  • A node must not be enqueued while it is already enqueued.
  • Node reuse is allowed only after the node has been dequeued.
  • The sentinel (stub) node must remain alive for the lifetime of the queue.
  • TryDequeue may return false even when a producer is mid-enqueue; this is expected behavior.

This type is not intended as a general-purpose collection.


When to use this

This queue is appropriate when:

  • You are building synchronization primitives (locks, semaphores, schedulers).
  • Allocation-free behavior is required.
  • You need precise control over memory ordering and concurrency behavior.
  • You can enforce a single-consumer contract.

If you need a general-purpose, multi-consumer queue, use System.Threading.Channels or ConcurrentQueue<T> instead.

Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.22 0 6/19/2026
4.0.21 94 6/5/2026
4.0.20 101 6/5/2026
4.0.19 106 6/5/2026
4.0.18 109 4/23/2026
4.0.17 105 4/23/2026
4.0.16 118 3/13/2026
4.0.15 108 3/12/2026
4.0.14 108 3/12/2026
4.0.13 115 3/12/2026
4.0.12 107 3/12/2026
4.0.11 118 3/12/2026
4.0.10 107 3/11/2026
4.0.9 104 3/10/2026
4.0.8 114 3/10/2026
4.0.7 115 3/9/2026
4.0.6 107 3/9/2026
4.0.5 105 3/9/2026
4.0.3 116 2/4/2026
4.0.2 113 2/4/2026
Loading failed

Update dependency Soenneker.Queues.Intrusive.Abstractions to 4.0.15 (#30)