Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jerry08/taskexecutor
Task Helper
https://github.com/jerry08/taskexecutor
Last synced: 4 days ago
JSON representation
Task Helper
- Host: GitHub
- URL: https://github.com/jerry08/taskexecutor
- Owner: jerry08
- License: gpl-3.0
- Created: 2023-03-01T13:28:31.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-04T19:11:01.000Z (over 1 year ago)
- Last Synced: 2024-04-27T08:04:09.724Z (6 months ago)
- Language: C#
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
TaskExecutor**TaskExecutor** is a library that makes it easier to run multiple tasks simultaneously by using of Semaphore.
## Install
- 📦 [NuGet](https://nuget.org/packages/TaskExecutor): `dotnet add package TaskExecutor`
## Usage
```csharp
using System;
using System.Linq;
using System.Threading.Tasks;
using TaskExecutor;var myAction = MyActionAsync;
var actions = Enumerable.Range(0, 11).Select(_ => myAction);// This runs 2 tasks at a time and wait unitl all tasks are completed.
var result = await TaskEx.Run(actions, 2);static int HelloCount;
async Task MyActionAsync()
{
await Task.Delay(1000);HelloCount++;
Console.WriteLine($"Hello ({HelloCount})");return 0;
}
```