GPS.SimpleThreading 3.0.0

.NET Standard 2.0
There is a newer version of this package available.
See the version list below for details.
Install-Package GPS.SimpleThreading -Version 3.0.0
dotnet add package GPS.SimpleThreading --version 3.0.0
<PackageReference Include="GPS.SimpleThreading" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GPS.SimpleThreading --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GPS.SimpleThreading, 3.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install GPS.SimpleThreading as a Cake Addin
#addin nuget:?package=GPS.SimpleThreading&version=3.0.0

// Install GPS.SimpleThreading as a Cake Tool
#tool nuget:?package=GPS.SimpleThreading&version=3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


What is it?

SimpleThreading is a set of classes to ease your multithreading.
There is a very simple ThreadBlock class to work with that allows you to get a result from each delegate call, unlike the ActionBlock Microsoft provides.

How do you use it?

SimpleThreading is a stand-alone library that you can use very easily. Simply import the NuGet package __GPS.SimpleThreading__ into your project.



    // Structure to write to on-the-fly.
    var results = new ConcurrentDictionary<string, int>();

    var block = new ThreadBlock<string, int>(
        // Lambda defining processing action per item
        item =>
            var result = 0;
            return int.TryParse(item, out result) ? result : 0;
        // Lambda defining processing action for end of batch
        results => 
            Debug.WriteLine($"Sum: {results.Where(r => r != null).Sum(r => r.result)}");
    // Add data to be processed.
    block.AddRange(new List<string>{ "1", "2", "3", "four", "5", "six", "7", "8", "nine", "10"});

    // Lock the list, preventing data from being added during processing.

    // Execute the batch
        // Max Degree of Parallelism
        // Warmup code for the item.  Executed before the 
        // main lambda.
        (item) => Debug.WriteLine($"Processing {item}.")
        // Continuation code per item.
        (item, result) =>
            results.Add(item, result);

    // Display completed results
        r => Console.Debug($"{r.Key} - {r.Value}"));

Where can I get it?

SimpleThreading is available on for easy inclusion in your .Net application from within Visual Studio. Simply open the Package Manager Console and type:

install-package GPS.SimpleThreading

Alternatively, you may download the package from GitHub.

Where can I get help?

You can log and track issues on GitHub or you can send an email to The Sharp Ninja.

What's this Gateway Programming School?

Gateway Programming School (or GPS for short) is a programming school in Clarksville, TN that is funding its startup costs through the creation of useful applications, frameworks and text books. GPS is a for profit school with the express goal of providing a first-class education in business-oriented computer programming in DotNet Core and related technologies.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on GPS.SimpleThreading:

Package Downloads

Simple Caching


Core library for ArchMastery.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.0 0 8/11/2022
4.0.0 184 7/15/2021
3.0.1 817 2/7/2019
3.0.0 452 2/5/2019 702 8/7/2017
2.0.0 638 8/4/2017
1.0.1 671 7/31/2017
1.0.0 1,056 7/27/2017

Version 3.0.0
Payton Byrd (The Sharp Ninja)

* Removed Paket
* Refactored projects for Netstandard 2.0
* Added per-item continuation
* Changed return types to inferred tuples containing the source data and result.