Class GatedTimer
Implements a timer that allows only one thread at a time to process timer events.
Namespace: Neon.Time
Assembly: Neon.Common.dll
Syntax
public class GatedTimer
Remarks
This is necessary to because the Timer class will continue firing thread handlers even if a long-running thread is still handling an earlier timer event.
Constructors
GatedTimer(TimerCallback, object, TimeSpan)
Initializes and starts the timer.
Declaration
public GatedTimer(TimerCallback callback, object state, TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
TimerCallback | callback | The callback to be called when the timer fires. |
object | state | Application state. |
TimeSpan | period | Time to wait between firing events. |
GatedTimer(TimerCallback, object, TimeSpan, TimeSpan)
Initializes and starts the timer.
Declaration
public GatedTimer(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
TimerCallback | callback | The callback to be called when the timer fires. |
object | state | Application state. |
TimeSpan | dueTime | Time to wait before firing the first event. |
TimeSpan | period | Time to wait between firing events. |
Methods
Change(TimeSpan, TimeSpan)
Modifies the timer.
Declaration
public void Change(TimeSpan dueTime, TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | dueTime | Time to wait before firing the first event. |
TimeSpan | period | Time to wait between firing events. |
Dispose()
Releases all resources associated with the timer.
Declaration
public void Dispose()
Dispose(bool)
Releases any important resources associated with the instance.
Declaration
protected void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Pass |
~GatedTimer()
Finalizer.
Declaration
protected ~GatedTimer()