NolanHodge.Threader 1.0.0

.NET Framework 4.0
Install-Package NolanHodge.Threader -Version 1.0.0
dotnet add package NolanHodge.Threader --version 1.0.0
<PackageReference Include="NolanHodge.Threader" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NolanHodge.Threader --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NolanHodge.Threader, 1.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 NolanHodge.Threader as a Cake Addin
#addin nuget:?package=NolanHodge.Threader&version=1.0.0

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

Threader

Threader is a nuget package for running Tasks in parallel like they are System.Threading.Threads.

This package is optimized for long running operations. The UWP 10.0 framework does not allow the usage of Threads, but rather Tasks. Tasks are not treated like Threads and a user will not get a desired result using them in that manner.

Threader allows users to execute long and short running operations in the same manner as Threads.

Example

  using NolanHodge.Threader;
  
  // A Class that satisfies the IThreader interface.
  class Button : IThreader
  {
      Action<object> Draw;
      public ButtonData(Canvas canvas, Action<object> action)
      {
          Canvas = canvas;
          Label = label;
      }

      public string Name()
      {
          return Canvas.Name;
      }

      public void Action()
      {
          Draw(this);
      }
  }

  // The Application requiring long running operations.
  class Application
  {
    Threader T = new Threader(); 
    void Init()
    {
        foreach (string name in canvases)
        {
            T.Spawn(new Button(name, Diagnose))
        }
    }

    // Kill the Threaders pool.
    void OnClose()
    {
      T.KillAll();
    }

    // Use the IThreader object in parallel, handling stops.
    void Diagnose(Button b)
    {
        while (true)
        {
            if (T.Killed(b))
            {
                return;
            }

            OnMainThread(Draw(b));
        }
    }
}

Product Versions
.NET Framework net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
1.0.0 290 11/17/2019