mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 10:26:11 +08:00
Codacy/PR Quality Review
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
namespace MQTTnet.Internal
|
||||
{
|
||||
// From Stephen Toub (https://blogs.msdn.microsoft.com/pfxteam/2012/02/12/building-async-coordination-primitives-part-6-asynclock/)
|
||||
public sealed class AsyncLock
|
||||
public sealed class AsyncLock : IDisposable
|
||||
{
|
||||
private readonly SemaphoreSlim m_semaphore = new SemaphoreSlim(1, 1);
|
||||
private readonly Task<IDisposable> m_releaser;
|
||||
@@ -25,6 +25,11 @@ namespace MQTTnet.Internal
|
||||
TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.m_semaphore?.Dispose();
|
||||
}
|
||||
|
||||
private sealed class Releaser : IDisposable
|
||||
{
|
||||
private readonly AsyncLock m_toRelease;
|
||||
|
||||
Reference in New Issue
Block a user