.Net Timers

  • Thread starter Thread starter R
  • Start date Start date
R

R

Hello,

I have a .net Timer in windows service. The service works
on MSCS with 2 nodes.
The problem is that the timer can work for weeks (It
raises every minute), and then, just like that it stops
from raising!
I can't re-pro the problem, but I sew it happen, and I
cant just ignore it.
What do I do?

Thanks..
 
Rather than using a timer, I would use an explicit loop, possibly in another
thread, and do a Thread.Sleep(60000) after every iteration. Seems much more
reliable than timers.

Chris
 
no,
loops aren't efficient as timers.
It does depend on how tight the loop is. For instance
while(true) Sleep(400);
creates a cpu hog.
Timer(400) doesn't create a hog, but it still is somewhat intensive.

Come to think of it, it really depends on how the code is setup. a very
short timer interval is about as wasteful as a while loop with a sleep
 
Two things:
1)The timer is depanded on an input from the user
(between 1 sec to 2 dayes) so, loop is not a good answer
for me.
2) Logs...
I wish I had someting. The application logs was empty
from errors. But I don't know what was in the system
log.
If I could re produce the situation, I could do
something, but I wasn't able to make it happen again.. :(
-----Original Message-----
no,
loops aren't efficient as timers.
It does depend on how tight the loop is. For instance
while(true) Sleep(400);
creates a cpu hog.
Timer(400) doesn't create a hog, but it still is somewhat intensive.

Come to think of it, it really depends on how the code is setup. a very
short timer interval is about as wasteful as a while loop with a sleep

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
Chris Capel said:
Rather than using a timer, I would use an explicit loop, possibly in
another
thread, and do a Thread.Sleep(60000) after every iteration. Seems much
more
reliable than timers.

Chris


.
 
Back
Top