Skip to content

๐Ÿ”’ .NET Nuget for a basic asynchronous locking recipe

License

Notifications You must be signed in to change notification settings

Jac21/AsyncLock.NET

Repository files navigation

logo

NuGet Status Build Status MIT Licence donate

๐Ÿ”’ .NET Nuget for a basic asynchronous locking recipe

Installation

Find it on nuget!

PM> Install-Package AsyncLock.NET -Version 6.0.1

API

Example usage

// example of an asynchronous operation setting a SignalR connection
HubConnection connection;

await AsyncLock.ExecuteWithLock(async () =>
{
    connection = await GetConnection("https://that.place.on.the.internet/hub");
});

await connection.StartAsync();
// example of setting the maximum number of requests for the semaphore 
// that can be granted concurrently which defaults to one
AsyncLock.MaxCount = 5;

// act
await AsyncLock.ExecuteWithLock(async () =>
{
    await Task.Delay(1000);

    return "Test";
});

About

๐Ÿ”’ .NET Nuget for a basic asynchronous locking recipe

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages