Skip to main content
net9.0.NETStandard2.0

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.

Published
Aug 12, 2024
2y ago
Total Downloads
13.8K
13,792

Install

dotnet add package SemaphoreSlimThrottling --version 1.0.12
ProductVersions
.NET
net9.0
.NET Standard
netstandard2.0

README

SemaphoreSlimThrottling SemaphoreSlimThrottling

GitHub Workflow Status Nuget Nuget Codacy Grade

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

v1.0.11v1.0.12
Deprecation Removed
Deprecation notice was removed in this version.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.