klhztrader/KLHZ.Trader.Core/Common/Extentions/SemaphoreSlimExtention.cs

12 lines
348 B
C#

namespace KLHZ.Trader.Core.Common.Extentions
{
internal static class SemaphoreSlimExtention
{
public static async Task WaitAsync2(this SemaphoreSlim semaphore, TimeSpan timeSpan)
{
var cts = new CancellationTokenSource(timeSpan);
await semaphore.WaitAsync(cts.Token);
}
}
}