GPS.SimpleThreading 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package GPS.SimpleThreading --version 3.0.0
NuGet\Install-Package GPS.SimpleThreading -Version 3.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="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
#r "nuget: GPS.SimpleThreading, 3.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 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

SimpleMVC

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.

ThreadBlock

Example:

    // 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.
    block.LockList();

    // Execute the batch
    block.Execute(
        // Max Degree of Parallelism
        5,  
        // 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
    results.ToList().ForEach(
        r => Console.Debug($"{r.Key} - {r.Value}"));

Where can I get it?

SimpleThreading is available on Nuget.org 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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.

This package has no dependencies.

NuGet packages (2)

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

Package Downloads
GPS.SimpleCache

Simple Caching

ArchMastery.Reflector.Common

Core library for ArchMastery.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.0 397 8/11/2022
4.0.0 350 7/15/2021
3.0.1 1,821 2/7/2019
3.0.0 614 2/5/2019
2.0.0.1 908 8/7/2017
2.0.0 833 8/4/2017
1.0.1 852 7/31/2017
1.0.0 1,477 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.