rlauuzo 1a731e3acc
Update MediaSegments directly (#350)
Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com>
Co-authored-by: Kilian von Pflugk <github@jumoog.io>
2024-10-19 20:49:47 +00:00

26 lines
609 B
C#

using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConfusedPolarBear.Plugin.IntroSkipper.ScheduledTasks;
internal sealed class ScheduledTaskSemaphore : IDisposable
{
private static readonly SemaphoreSlim _semaphore = new(1, 1);
private ScheduledTaskSemaphore()
{
}
public static async Task<IDisposable> AcquireAsync(CancellationToken cancellationToken)
{
await _semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
return new ScheduledTaskSemaphore();
}
public void Dispose()
{
_semaphore.Release();
}
}