crossbeam-queue 1.0.6

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

crossbeam-queue

NuGet

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

ArrayQueue<T>

Use ArrayQueue<T> when the number of queued elements must stay within a fixed bound. Its constructor requires a positive capacity, which sets the maximum number of queued elements.

  • TryEnqueue leaves a full queue unchanged and returns false.
  • Enqueue always adds the new element. If the queue is full, it removes the oldest element and reports 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);

EnqueueResult.TryGetOverwritten returns true if an element was replaced. Otherwise, it returns false and sets the output to default. Check the Boolean result: the replaced element itself may be null or the default value of T.

SegQueue<T>

Use SegQueue<T> when you need a queue without a fixed element-count limit.

  • The queue allocates blocks as needed.
  • Its constructor requires a positive capacity. This sets the maximum number of unused blocks retained for reuse; it does not limit queued elements. 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.

  • Count and IsEmpty are snapshots and may change immediately. ArrayQueue<T> also exposes a fixed Capacity and snapshot IsFull. Use the result of TryEnqueue or TryDequeue to know whether that operation succeeded.
  • null is a valid element. TryDequeue returns true and the removed value when successful; if the queue is empty, it returns false and sets the output to default. Use the Boolean result to distinguish an empty queue from one that returned null.

Api scope

These queues are not drop-in replacements for ConcurrentQueue<T>. They focus on enqueue and dequeue operations and do not provide:

  • TryPeek
  • GetEnumerator
  • 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