Class TimerFactory
- Namespace
- Cuemon.Threading
- Assembly
- Cuemon.Core.dll
Provides access to factory methods for creating and configuring System.Threading.Timer instances.
public static class TimerFactory
- Inheritance
-
ObjectTimerFactory
Methods
CreateNonCapturingTimer(TimerCallback, Object, TimeSpan, TimeSpan)
Initializes a new instance of the System.Threading.Timer class that suppress capturing the ExecutionContext.
public static Timer CreateNonCapturingTimer(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
Parameters
callback
TimerCallbackA delegate representing a method to be executed.
state
ObjectAn object containing information to be used by the callback method, or
null
.dueTime
TimeSpanThe amount of time to delay before the callback is invoked. Specify System.Threading.Timeout.InfiniteTimeSpan to prevent the timer from starting. Specify System.TimeSpan.Zero to start the timer immediately.
period
TimeSpanThe time interval between invocations of callback. Specify System.Threading.Timeout.InfiniteTimeSpan to disable periodic signaling.
Returns
- Timer
A new System.Threading.Timer instance that suppress capturing the ExecutionContext.
Remarks
Used by Microsoft internally in various scenarios: https://github.com/dotnet/runtime/blob/master/src/libraries/Common/src/Extensions/NonCapturingTimer/NonCapturingTimer.cs