System.Timers.ElapsedEventArgs.SignalTime Property

Gets the time the Timer.Elapsed event was raised.

Syntax

public DateTime SignalTime { get; }

Value

Documentation for this section has not yet been entered.

Remarks

The Timer.Elapsed event is raised on a System.Threading.ThreadPool thread, so the event-handling method might run on one thread at the same time that a call to the Timer.Stop method runs on another thread. This might result in the Timer.Elapsed event being raised after the Timer.Stop method is called. This race condition cannot be prevented simply by comparing the ElapsedEventArgs.SignalTime property with the time when the Timer.Stop method is called, because the event-handling method might already be executing when the Timer.Stop method is called, or might begin executing between the moment when the Timer.Stop method is called and the moment when the stop time is saved. If it is critical to prevent the thread that calls the Timer.Stop method from proceeding while the event-handling method is still executing, use a more robust synchronization mechanism such as the System.Threading.Monitor class or the erload:System.Threading.Interlocked.CompareExchange method. Code that uses the erload:System.Threading.Interlocked.CompareExchange method can be found in the example for the Timer.Stop method.

Requirements

Namespace: System.Timers
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0