Running Timer - ZjzMisaka/PowerThreadPool GitHub Wiki
After setting WorkOption.RunningTimerOption, Action<RunningTimerElapsedEventArgs> Elapsed
will occur when the interval elapses, but only if the thread pool is in the Running state.
RunningTimerElapsedEventArgs
Properties
[Get only]
The date/time when the System.Timers.Timer.Elapsed event was raised.
DateTime SignalTime;
[Get only]
Pool runtime duration.
TimeSpan RuntimeDuration;
Sample
PowerPool powerPool = new PowerPool(new PowerPoolOption
{
RunningTimerOption = new RunningTimerOption
{
Elapsed = (e) =>
{
// Perform an action every 500ms
// Access the signal time: e.SignalTime
// Access the runtime duration: e.RuntimeDuration
},
Interval = 500,
}
});