Jeff said:
Well, take this with a grain of salt, but I seem to recall HEARING (i.e., I
haven't tested it) that timer events are non-re-entrant, meaning that you
will not get another Tick event until you've exited the event handler. It
ought to be a relatively easy thing to test for.
For System.Forms.Timer, this is completely true. It uses window
messages to deliver the tick, and _no_ window messages can be processed
while the Tick event is being handled, including the one for the next
Tick. (Which is not to say those messages won't pile up...they just
won't get fired while you're working on handling one of them).
For the OP, for me the implication here is that performing timer-based
work in the Tick event handler of a System.Forms.Timer instance is the
wrong thing to do. Blocking the GUI thread for even 500ms isn't great,
but for a full second? That's definitely wrong.
Mike's observation that every 500 ms doing work that takes 1000 ms is a
flawed idea is also accurate, and the OP will need to figure that aspect
out too.
The bottom line: the timer should be assumed to fire every 500 ms, no
matter what. This could be because the work done on the interval is
handed off to a thread pool thread, or it could be because a different,
threaded timer is used instead of System.Forms.Timer. Then, with that
knowledge in hand, the OP can move on to figuring out what the heck he's
actually doing starting 1 second's worth of work every half-second.
Pete