To be more specific: in either scenario the Enabled property should be
False.  SignalTime's documentation suggests that the event should not be
processed in scenario 2.

If you want to decide whether to process the event based upon when the
event is RECEIVED, then use the Enabled property.  If you want to decide
whether to process the event based upon when the event was FIRED, then use
the SignalTime property, as documented.

http://www.peterritchie.com/

On Fri, 7 Oct 2005 05:19:33 -0400, Fabian Schmied <[EMAIL PROTECTED]>
wrote:

>>My question is: Instead of using the SignalTime property to stop
>>processing the Elapsed event after Stop() is called, couldn't you simply
>>check whether Enabled is True or False?
>
>(The following text is written without knowledge of the exact innards of
>System.Timers.Timer. It is therefore somewhat speculative.)
>
>Due to the timer using multithreading, Enabled might be set to false,
>although the event was signaled at the right time. Consider the following
>scenarios: in both, Enabled is set to false, but in scenario 1, the event
>was scheduled before the stop method was called, while in scenario 2, the
>event was scheduled afterwards. There might be use cases, where the event
>of scenario 1 must be handled, while that of scenario 2 must not.
>
>Scenario 1:
>1 - Timer fires
>2 - Stop is called
>3 - Event is executed: SignalTime is 1 (before Stop)
>4 - Timer is stopped
>
>Scenaro 2:
>1 - Stop is called
>2 - Timer fires
>3 - Event is executed: SignalTime is 2 (after Stop)
>4 - Timer is stopped

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to