Class ExclusiveTimer
A threading Swan.Threading.ExclusiveTimer._backingTimer implementation that executes at most one cycle at a time
in a
Namespace: Swan.Threading
Syntax
public sealed class ExclusiveTimer : IDisposable
Constructors
ExclusiveTimer(Action)
Initializes a new instance of the ExclusiveTimer class.
Declaration
public ExclusiveTimer(Action timerCallback)
Parameters
Type | Name | Description |
---|---|---|
Action | timerCallback | The timer callback. |
ExclusiveTimer(Action, Int32, Int32)
Initializes a new instance of the ExclusiveTimer class.
Declaration
public ExclusiveTimer(Action timerCallback, int dueTime, int period)
Parameters
Type | Name | Description |
---|---|---|
Action | timerCallback | The timer callback. |
Int32 | dueTime | The due time. |
Int32 | period | The period. |
ExclusiveTimer(Action, TimeSpan, TimeSpan)
Initializes a new instance of the ExclusiveTimer class.
Declaration
public ExclusiveTimer(Action timerCallback, TimeSpan dueTime, TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
Action | timerCallback | The timer callback. |
TimeSpan | dueTime | The due time. |
TimeSpan | period | The period. |
ExclusiveTimer(TimerCallback)
Initializes a new instance of the ExclusiveTimer class.
Declaration
public ExclusiveTimer(TimerCallback timerCallback)
Parameters
Type | Name | Description |
---|---|---|
TimerCallback | timerCallback | The timer callback. |
ExclusiveTimer(TimerCallback, Object, Int32, Int32)
Initializes a new instance of the ExclusiveTimer class.
Declaration
public ExclusiveTimer(TimerCallback timerCallback, object state, int dueTime, int period)
Parameters
Type | Name | Description |
---|---|---|
TimerCallback | timerCallback | The timer callback. |
Object | state | The state. |
Int32 | dueTime | The due time. |
Int32 | period | The period. |
ExclusiveTimer(TimerCallback, Object, TimeSpan, TimeSpan)
Initializes a new instance of the ExclusiveTimer class.
Declaration
public ExclusiveTimer(TimerCallback timerCallback, object state, TimeSpan dueTime, TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
TimerCallback | timerCallback | The timer callback. |
Object | state | The state. |
TimeSpan | dueTime | The due time. |
TimeSpan | period | The period. |
Properties
IsDisposed
Gets a value indicating whether this instance is disposed.
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsDisposing
Gets a value indicating whether this instance is disposing.
Declaration
public bool IsDisposing { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Methods
Change(Int32, Int32)
Changes the start time and the interval between method invocations for the internal timer.
Declaration
public void Change(int dueTime, int period)
Parameters
Type | Name | Description |
---|---|---|
Int32 | dueTime | The due time. |
Int32 | period | The period. |
Change(TimeSpan, TimeSpan)
Changes the start time and the interval between method invocations for the internal timer.
Declaration
public void Change(TimeSpan dueTime, TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | dueTime | The due time. |
TimeSpan | period | The period. |
Dispose()
Declaration
public void Dispose()
Pause()
Pauses this instance.
Declaration
public void Pause()
Resume(Int32)
Changes the interval between method invocations for the internal timer.
Declaration
public void Resume(int period)
Parameters
Type | Name | Description |
---|---|---|
Int32 | period | The period. |
Resume(TimeSpan)
Changes the interval between method invocations for the internal timer.
Declaration
public void Resume(TimeSpan period)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | period | The period. |
Wait(TimeSpan, CancellationToken)
Waits the specified wait time.
Declaration
public static void Wait(TimeSpan waitTime, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | waitTime | The wait time. |
CancellationToken | cancellationToken | The cancellation token. |
WaitUntil(DateTime, CancellationToken)
Waits until the time is elapsed.
Declaration
public static void WaitUntil(DateTime untilDate, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
DateTime | untilDate | The until date. |
CancellationToken | cancellationToken | The cancellation token. |