Backport.System.Threading.Lock 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Backport.System.Threading.Lock --version 1.1.1                
NuGet\Install-Package Backport.System.Threading.Lock -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="Backport.System.Threading.Lock" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Backport.System.Threading.Lock --version 1.1.1                
#r "nuget: Backport.System.Threading.Lock, 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 Backport.System.Threading.Lock as a Cake Addin
#addin nuget:?package=Backport.System.Threading.Lock&version=1.1.1

// Install Backport.System.Threading.Lock as a Cake Tool
#tool nuget:?package=Backport.System.Threading.Lock&version=1.1.1                

Backport.System.Threading.Lock Backport.System.Threading.Lock

GitHub Workflow Status NuGet NuGet Codacy Grade Codecov

A micro-library that backports .NET 9.0+'s System.Threading.Lock to prior versions (from .NET Framework 3.5 up to .NET 8.0), providing as much backward compatibility as possible.

Usage

Use this library the same way you would use System.Threading.Lock.

In order to get the performance benefits of System.Threading.Lock, you must however multi-target frameworks in your .csproj file.

Example:

<TargetFrameworks>netstandard2.0;net9.0</TargetFrameworks>

Performance

This library was benchmarked against locking on an object on .NET 8.0 and no speed or memory allocation difference was noted, whereas when .NET 9.0 was used the performance was ~25% better as opposed to locking on an object.

Credits

Check out our list of contributors!

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.  net9.0 is compatible. 
.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 net35 is compatible.  net40 was computed.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  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.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Backport.System.Threading.Lock:

Package Downloads
DisCatSharp

DisCatSharp Your library to write discord bots in C# with a focus on always providing access to the latest discord features. Written with love and for everyone.

DisCatSharp.Common

DisCatSharp Common Extension Common tools for DisCatSharp, like regexes and converters!

EasyMemoryCache

MemoryCache component, for easy MemoryCache implementation

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.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Backport.System.Threading.Lock:

Repository Stars
Aiko-IT-Systems/DisCatSharp
Your library to write discord apps in C# with focus on always providing access to the latest discord features
Version Downloads Last updated
1.1.6 962 8/20/2024
1.1.5 83 8/20/2024
1.1.1 123 8/13/2024
1.1.0 65 8/13/2024
1.0.2 205 8/12/2024
1.0.1 113 8/11/2024 1.0.1 is deprecated because it has critical bugs.

Made SecurityTransparent.