Click or drag to resize

SharedTimer Class

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

Namespace: GSF.Threading
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public sealed class SharedTimer : IDisposable
View Source

The SharedTimer type exposes the following members.

Properties
 NameDescription
Public propertyAutoReset Gets or sets flag that indicates whether the SharedTimer should raise the Elapsed event only once false or repeatedly true.
Public propertyEnabled Gets or sets flag that indicates whether the SharedTimer should raise the Elapsed event.
Public propertyInterval Gets or sets the interval at which to raise the Elapsed event.
Top
Methods
 NameDescription
Public methodClose Stops the timer.
Public methodDispose Stops the timer and prevents reuse of the class.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStart Starts raising the Elapsed event by setting Enabled to true.
Public methodStop Stops raising the Elapsed event by setting Enabled to false.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Events
 NameDescription
Public eventElapsed Occurs when the timer interval elapses.
Public eventUnhandledExceptions Occurs when Elapsed event throws an exception.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks

Externally the SharedTimer operations similar to the 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.

See Also