PeriodicTimer extensions for System.TimeProvider.
public static class TimeProviderPeriodicTimerExtensions
Inheritance System.Object 🡒 TimeProviderPeriodicTimerExtensions
Factory method that creates a periodic timer that enables waiting asynchronously for timer ticks. Use this factory method as a replacement for instantiating a System.Threading.PeriodicTimer.
public static System.Threading.PeriodicTimerWrapper CreatePeriodicTimer(this TimeProvider timeProvider, System.TimeSpan period);
timeProvider
System.TimeProvider
period
System.TimeSpan
PeriodicTimerWrapper
A new PeriodicTimerWrapper.
Note, this is a wrapper around a System.Threading.PeriodicTimer,
and will behave exactly the same as the original.
This timer is intended to be used only by a single consumer at a time: only one call to System.Threading.PeriodicTimer.WaitForNextTickAsync(System.Threading.CancellationToken) may be in flight at any given moment. System.Threading.PeriodicTimer.Dispose may be used concurrently with an active System.Threading.PeriodicTimer.WaitForNextTickAsync(System.Threading.CancellationToken) to interrupt it and cause it to return false.