mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
bb9ef89dee
7Zip extracted archives now only extract the fewest files required. Audited the uses of .Wait Lazily init the VFS cleaning
22 lines
491 B
C#
22 lines
491 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reactive.Disposables;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Wabbajack.Common
|
|
{
|
|
public class AsyncLock
|
|
{
|
|
private readonly SemaphoreSlim _lock = new SemaphoreSlim(1, 1);
|
|
|
|
public async Task<IDisposable> WaitAsync()
|
|
{
|
|
await _lock.WaitAsync();
|
|
return Disposable.Create(() => _lock.Release());
|
|
}
|
|
}
|
|
}
|