C# Class GSF.Threading.SharedTimer

Represents a timer class that will group registered timer event callbacks that operate on the same interval in order to optimize thread pool queuing.

Externally the SharedTimer operations similar to the System.Timers.Timer. Internally the timer pools callbacks with the same Interval into a single timer where each callback is executed on the same thread, per instance of the SharedTimerScheduler.

Any long running callbacks that have a risk of long delays should not use SharedTimer as this will effect the reliability of all of the other SharedTimer instances for a given SharedTimerScheduler.

Inheritance: IDisposable
显示文件 Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Stops the timer.

Dispose ( ) : void

Stops the timer and prevents reuse of the class.

Start ( ) : void

Starts raising the Elapsed event by setting Enabled to true.

Stop ( ) : void

Stops raising the Elapsed event by setting Enabled to false.

Private Methods

Method Description
SharedTimer ( SharedTimerScheduler scheduler, int interval = 100 ) : System
TimerCallback ( System.DateTime state ) : void

Callback from SharedTimerScheduler.

Method Details

Close() public method

Stops the timer.
public Close ( ) : void
return void

Dispose() public method

Stops the timer and prevents reuse of the class.
public Dispose ( ) : void
return void

Start() public method

Starts raising the Elapsed event by setting Enabled to true.
public Start ( ) : void
return void

Stop() public method

Stops raising the Elapsed event by setting Enabled to false.
public Stop ( ) : void
return void