NTDLS.DelegateThreadPool 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package NTDLS.DelegateThreadPool --version 1.0.0
NuGet\Install-Package NTDLS.DelegateThreadPool -Version 1.0.0
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="NTDLS.DelegateThreadPool" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NTDLS.DelegateThreadPool --version 1.0.0
#r "nuget: NTDLS.DelegateThreadPool, 1.0.0"
#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.
// Install NTDLS.DelegateThreadPool as a Cake Addin
#addin nuget:?package=NTDLS.DelegateThreadPool&version=1.0.0

// Install NTDLS.DelegateThreadPool as a Cake Tool
#tool nuget:?package=NTDLS.DelegateThreadPool&version=1.0.0

NTDLS.Persistence

📦 Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.DelegateThreadPool

Active thread pool where work items can be queued as delegate functions. Allows you to easily enqueue infinite FIFO worker items and wait on collections of those items to complete.

private static readonly DelegateThreadPool _delegateThreadPool = new(10);

static void Main()
{
    CollectionExample();
    NoCollectionExample();

    Console.WriteLine("Press [enter] to exit.");
    Console.ReadLine();

    _delegateThreadPool.Dispose();
}

private static void CollectionExample()
{
    Console.WriteLine("CollectionExample: Starting to enqueue items...");

    var queuedStates = _delegateThreadPool.CreateQueueStateCollection();

    //Enqueue work items as delegate functions.
    for (int i = 0; i < 100; i++)
    {
        queuedStates.Enqueue(() =>
        {
            Thread.Sleep(1000); //Do some work...
        });
    }

    Console.WriteLine("Enqueue complete, waiting on completion.");

    //Wait on all of the workitems to complete.
    queuedStates.WaitForCompletion();

    Console.WriteLine("All workers are complete.");
}

private static void NoCollectionExample()
{
    Console.WriteLine("NoCollectionExample: Starting to enqueue items...");

    var queueTokens = new List<QueueItemState>();

    //Enqueue work items as delegate functions.
    for (int i = 0; i < 100; i++)
    {
        var queueItemState = _delegateThreadPool.Enqueue(() =>
        {
            Thread.Sleep(1000); //Do some work...
        });

        queueTokens.Add(queueItemState);
    }

    Console.WriteLine("Enqueue complete, waiting on completion.");

    //Wait on all of the workitems to complete.
    queueTokens.ForEach(t => t.WaitForCompletion());

    Console.WriteLine("All workers are complete.");
}
Product Compatible and additional computed target framework versions.
.NET 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. 
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

Added optional serialization encryption provider.