crossbeam-queue 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package crossbeam-queue --version 1.0.5
                    
NuGet\Install-Package crossbeam-queue -Version 1.0.5
                    
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="crossbeam-queue" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="crossbeam-queue" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="crossbeam-queue" />
                    
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 crossbeam-queue --version 1.0.5
                    
#r "nuget: crossbeam-queue, 1.0.5"
                    
#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 crossbeam-queue@1.0.5
                    
#: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=crossbeam-queue&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=crossbeam-queue&version=1.0.5
                    
Install as a Cake Tool

crossbeam-queue

NuGet

Concurrent multi-producer, multi-consumer queues for C#.

Choose a queue

Type Storage Behavior
ArrayQueue<T> Fixed-capacity array TryEnqueue returns false when full. Enqueue replaces the oldest element when full and reports the replaced value.
SegQueue<T> Linked, fixed-size blocks Grows as needed. Its constructor capacity limits how many unused blocks are retained for reuse, not how many elements can be queued.

Both constructors require a positive capacity.

ArrayQueue<T>

Use ArrayQueue<T> when the number of queued elements must stay within a fixed bound. TryEnqueue leaves a full queue unchanged and returns false. Enqueue always adds the new element; when full, it removes the oldest element and returns it in an EnqueueResult.

using System;
using crossbeam;

var queue = new ArrayQueue<string>(capacity: 2);
queue.TryEnqueue("first");
queue.TryEnqueue("second");

ArrayQueue<string>.EnqueueResult result = queue.Enqueue("third");
if (result.TryGetOverwritten(out var overwritten))
    Console.WriteLine($"Replaced: {overwritten}");

while (queue.TryDequeue(out var item))
    Console.WriteLine(item);

Use EnqueueResult.TryGetOverwritten to determine whether an element was replaced and retrieve it. The replaced value may itself be null or the default value of T.

SegQueue<T>

Use SegQueue<T> when there is no fixed element capacity. It allocates additional blocks as needed. Its constructor argument sets the maximum number of unused blocks kept for reuse; blocks beyond that limit are not retained in the reuse pool.

using System;
using crossbeam;

var queue = new SegQueue<string>(capacity: 4);
queue.Enqueue("first");
queue.Enqueue("second");

while (queue.TryDequeue(out var item))
    Console.WriteLine(item);

Concurrent use

Both queue types support concurrent producers and consumers. Both expose Count and IsEmpty; ArrayQueue<T> also exposes Capacity and IsFull. These properties report the state observed when read, and another operation may change the queue immediately afterward. Do not use them to reserve capacity or coordinate queue operations; use the result of TryEnqueue or TryDequeue instead.

The queues accept null values. For TryDequeue, use the returned bool to distinguish an empty queue from a dequeued null value.

Api scope

These queues are not drop-in replacements for ConcurrentQueue<T>, they do not provide TryPeek, GetEnumerator, or Clear.

Rust implementations

License

Distributed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

  • net10.0

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on crossbeam-queue:

Package Downloads
ErinnTask

Lightweight asynchronous primitives.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.7 120 10/24/2026
1.0.6 137 10/21/2026
1.0.5 105 10/21/2026
1.0.4 124 10/20/2026
1.0.3 141 10/19/2026
1.0.2 112 10/19/2026
1.0.1 110 10/19/2026
1.0.0 104 10/19/2026