dmuka3.CS.Simple.Semaphore
1.0.1
dotnet add package dmuka3.CS.Simple.Semaphore --version 1.0.1
NuGet\Install-Package dmuka3.CS.Simple.Semaphore -Version 1.0.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="dmuka3.CS.Simple.Semaphore" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add dmuka3.CS.Simple.Semaphore --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: dmuka3.CS.Simple.Semaphore, 1.0.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 dmuka3.CS.Simple.Semaphore as a Cake Addin #addin nuget:?package=dmuka3.CS.Simple.Semaphore&version=1.0.1 // Install dmuka3.CS.Simple.Semaphore as a Cake Tool #tool nuget:?package=dmuka3.CS.Simple.Semaphore&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
dmuka3.CS.Simple.Semaphore
You can manage multiple "Thread" on application server using this library. So the "Thread Count" on server is always fix.
Public Variables
CoreCount
"Thread Count" for actions on server.
public int CoreCount { get; }
Disposed
Is the current instance dispose?
public bool Disposed { get; }
Started
Was the current instance start?.
public bool Started { get; }
Public Methods
Start
This is for start to current instance
public void Start()
AddAction
The current instance add to queue.
public void AddAction(Action action)
Dispose
Is the current instance dispose?
public void Dispose()
Example Usage
using System;
using System.Threading;
namespace dmuka3.CS.Simple.Semaphore.TestsConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("===== Muhammet Kandemir ======");
Console.WriteLine("Welcome dmuka3.CS.Simple.Semaphore Tests!");
// Create instance new semphore
// This instance will have 4 core(Thread)
ActionQueue semaphore = new ActionQueue(coreCount: 4);
// Start semaphore as async
semaphore.Start();
var rowIndex = 0;
// This thread is for add 10 action per 5 second
// And each action wait 1 second after complate
new Thread(() =>
{
while (true)
{
for (int i = 0; i < 10; i++)
{
semaphore.AddAction(() =>
{
Console.WriteLine("Row Index = {0}", ++rowIndex);
Thread.Sleep(1000);
});
}
Thread.Sleep(5000);
}
}).Start();
while (true)
Thread.Sleep(1);
}
}
}
Product | Versions 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 | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on dmuka3.CS.Simple.Semaphore:
Package | Downloads |
---|---|
dmuka3.CS.Simple.RamDb
Package Description |
|
dmuka3.CS.Simple.Queuing
Package Description |
|
dmuka3.CS.Simple.RemoteIO
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.