mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
17 lines
366 B
C#
17 lines
366 B
C#
using System;
|
|
using System.Reactive.Disposables;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Wabbajack.Common;
|
|
|
|
public class AsyncLock
|
|
{
|
|
private readonly SemaphoreSlim _lock = new(1, 1);
|
|
|
|
public async Task<IDisposable> WaitAsync()
|
|
{
|
|
await _lock.WaitAsync();
|
|
return Disposable.Create(() => _lock.Release());
|
|
}
|
|
} |