MultithreadingScaffold 1.1.1

dotnet add package MultithreadingScaffold --version 1.1.1                
NuGet\Install-Package MultithreadingScaffold -Version 1.1.1                
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="MultithreadingScaffold" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MultithreadingScaffold --version 1.1.1                
#r "nuget: MultithreadingScaffold, 1.1.1"                
#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 MultithreadingScaffold as a Cake Addin
#addin nuget:?package=MultithreadingScaffold&version=1.1.1

// Install MultithreadingScaffold as a Cake Tool
#tool nuget:?package=MultithreadingScaffold&version=1.1.1                

MultithreadingScaffold

Multi-threading work scaffolding, used to quickly create multi-threaded work code.

QuickStart

using MultithreadingScaffold;
//Normal Mode
var arr = new string[] { "A", "B", "C" };
MTScaffold mTScaffold = new MTScaffold();
mTScaffold.Worker = (i) =>
{
    Console.WriteLine(arr[i]);
};
mTScaffold.Final = () =>
{
    Console.WriteLine("It's Over.");
};
mTScaffold.Workload = arr.Count;
mTScaffold.Start();
using MultithreadingScaffold;
//Plan Mode
var arr = new string[] { "A", "B", "C" };
MTScaffold mTScaffold = new MTScaffold();
mTScaffold.Worker = (i) =>
{
    Console.WriteLine(arr[i]);
};
mTScaffold.Final = () =>
{
    Console.WriteLine("It's Over.");
};
mTScaffold.IsPlanMode = true;
mTScaffold.Workload = arr.Count;
mTScaffold.Start();

Param

  • IsPlanMode, bool, Optional —— In this mode, MTScaffold will slice tasks and start fixed num threads to handle section. Dramatically improve performance by reducing context switching. 在计划模式下,MTScaffold 会对整体任务进行切分,并以固定数量的线程来对任务进行处理。通过减少线程的上下文切换,可以大幅的提升性能。
  • Workload, int, Required —— Used to determine how many threads are counted as the end of the total task after work. 工作量,用于判断多少个线程工作完毕后算作总任务结束。
  • Worker, ThreadWorker, Required —— The multi-threading delegate used. 用于多线程工作执行的委托。
  • Final, ThreadFinal, Optional —— Action after multi-threading work end. 工作结束时调用。
  • InNewThread, bool, Optional —— If use a new thread to start work, or block the current thread. 是否开启新线程作为调度线程,若为false则会阻塞当前线程。- Locker, object, Optional —— Specify an object as a lock, if not specified, an Object will be automatically created as a lock. 指定作为锁的一个对象,若不指定则会自动创建一个Object作为锁。
  • WriteConsole, bool, Optional —— Whether to print information related to thread work, closed by default. 是否打印和线程工作相关的信息,默认关闭。
  • ThreadLimit, int, Optional —— Maximum number of threads, if not specified or specified as 0, it will be automatically adjusted according to the number of CPU cores in the system. 最大线程数,若不指定或指定为0则会根据系统CPU核心数自动调整。
  • SleepTime, int, Optional —— The sleep time of the startup thread, which affects the interval of starting a new thread each time, defaults to 100. 启动线程的睡眠时间,影响每次启动新线程的间隔,默认100。
  • TTL, int, Optional —— The survival time of the entire MTScaffold object, beyond this time will stop all threads, in seconds, the default value is -1 that does not open. 整个MTScaffold对象的存活时间,超出这个时间将停止所有线程,单位秒,默认值为-1即不开启。
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.
  • .NETStandard 2.0

    • 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.1.1 134 3/22/2024
1.1.0 109 3/21/2024
1.0.1 566 6/22/2020
1.0.0 460 4/27/2020

Multi-threading work scaffolding, used to quickly create multi-threaded work code.
多线程工作脚手架,用于快速创建多线程工作代码。