Skip to content

Commit 917069f

Browse files
committed
Refactor LocalAbpDistributedLockHandle to use SemaphoreSlim
1 parent 0294c80 commit 917069f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
using System;
1+
using System.Threading;
22
using System.Threading.Tasks;
33

4-
namespace Volo.Abp.DistributedLocking;
5-
6-
public class LocalAbpDistributedLockHandle : IAbpDistributedLockHandle
4+
namespace Volo.Abp.DistributedLocking
75
{
8-
private readonly IDisposable _disposable;
9-
10-
public LocalAbpDistributedLockHandle(IDisposable disposable)
6+
public class LocalAbpDistributedLockHandle : IAbpDistributedLockHandle
117
{
12-
_disposable = disposable;
13-
}
8+
private readonly SemaphoreSlim _semaphore;
149

15-
public ValueTask DisposeAsync()
16-
{
17-
_disposable.Dispose();
18-
return default;
10+
public LocalAbpDistributedLockHandle(SemaphoreSlim semaphore)
11+
{
12+
_semaphore = semaphore;
13+
}
14+
15+
public ValueTask DisposeAsync()
16+
{
17+
_semaphore.Release();
18+
return default;
19+
}
1920
}
2021
}

0 commit comments

Comments
 (0)