mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
32 lines
663 B
C#
32 lines
663 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BTCPayServer
|
|
{
|
|
public interface IDelay
|
|
{
|
|
Task Wait(TimeSpan delay, CancellationToken cancellationToken);
|
|
}
|
|
|
|
public class TaskDelay : IDelay
|
|
{
|
|
TaskDelay()
|
|
{
|
|
|
|
}
|
|
private static readonly TaskDelay _Instance = new TaskDelay();
|
|
public static TaskDelay Instance
|
|
{
|
|
get
|
|
{
|
|
return _Instance;
|
|
}
|
|
}
|
|
public Task Wait(TimeSpan delay, CancellationToken cancellationToken)
|
|
{
|
|
return Task.Delay(delay, cancellationToken);
|
|
}
|
|
}
|
|
}
|