A .NET Standard 2.0 library that provides a class that uses SemaphoreSlim but allows a negative initialCount. This could be used, for example, when starting to throttle requests but initially already have more concurrent requests than the maximum you want to start allowing.
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard |
README
SemaphoreSlimThrottling
A .NET Standard 2.0 library that provides a class that uses SemaphoreSlim but allows a negative initialCount. This could be used, for example, when starting to throttle requests but initially already have more concurrent requests than the maximum you want to start allowing.
Supports .NET Framework 4.6.1 or later, .NET Core 2.0 or later, and .NET 5.0 or later.
Installation
The recommended means is to use NuGet, but you could also download the source code from here.
Usage
// there are 11 concurrent requests, and we want to start limiting to 10.
// SemaphoreSlim does not allow negative initialCount.
var mySemaphore = new SemaphoreSlimThrottle(-1, 10);
For more information, read the documentation for SemaphoreSlim.
Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.