|
|
|
start date: Mon, 6 Aug 2007 17:22:02 -0700,
posted on: microsoft.public.dotnet.framework
back
| Thread Index |
|
1
Andrew
|
|
2
Peter Duniho
|
|
3
sloan
|
|
4
GlennDoten
|
Timer used in Windows Services
Hello, friends,
I am programming a Windows Service using .net 2005. In this service, I need
a timer to check file status in a predefined interval. However, as you may
have experienced by yourself or read through internet, the
System.Timers.Timer() is not reliable: The timer event may not be fired at
all sometimes.
Any good/reliable solutions/approaches for this? Thanks a lot.
Date:Mon, 6 Aug 2007 17:22:02 -0700
Author:
|
Re: Timer used in Windows Services
Andrew wrote:
> I am programming a Windows Service using .net 2005. In this service, I need
> a timer to check file status in a predefined interval. However, as you may
> have experienced by yourself or read through internet, the
> System.Timers.Timer() is not reliable: The timer event may not be fired at
> all sometimes.
>
> Any good/reliable solutions/approaches for this? Thanks a lot.
The only problem I've read about with respect to any timer problems in
..NET is a timer that has been configured to repeat, and which has been
left running for an extended period of time (I don't recall the
specifics, but "49 days" seems to pop into my head for some reason).
If your application is one that might be affected by this, my
understanding is that simply changing the timer usage so that you reset
the timer each time it is signaled, and start it again with a new
interval, it works fine.
If you expect there to be a problem, my suggestion is that you first
reproduce the problem in your own code. Then you will have a better
idea of whether it's really a problem, and you will be able to ensure
that you have satisfactorily worked around the problem.
Pete
Date:Mon, 06 Aug 2007 17:33:21 -0700
Author:
|
Re: Timer used in Windows Services
You should "code up" a timer.
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_thread/thread/aa8a7a59b698f6b5/009395e3234a3dbc?lnk=st&q=sloan+%22Private+m_doTheWorkTimer+As+Timer%22&rnum=3#009395e3234a3dbc
I think I have a link at the bottom of that post, which refs a MS KB article
about the "why".
or
http://groups.google.com/groups/search?q=sloan+%22Private+m_doTheWorkTimer+As+Timer%22
or
http://msdn2.microsoft.com/en-us/library/system.threading.timercallback.aspx
"Andrew" wrote in message
news:E1DD11C3-9D5F-41C9-9472-07A5CA6C9BD9@microsoft.com...
> Hello, friends,
>
> I am programming a Windows Service using .net 2005. In this service, I
> need
> a timer to check file status in a predefined interval. However, as you may
> have experienced by yourself or read through internet, the
> System.Timers.Timer() is not reliable: The timer event may not be fired at
> all sometimes.
>
> Any good/reliable solutions/approaches for this? Thanks a lot.
Date:Mon, 6 Aug 2007 20:43:16 -0400
Author:
|
Re: Timer used in Windows Services
sloan wrote:
> You should "code up" a timer.
>
> http://groups.google.com/group/microsoft.public.dotnet.framework/browse_thread/thread/aa8a7a59b698f6b5/009395e3234a3dbc?lnk=st&q=sloan+%22Private+m_doTheWorkTimer+As+Timer%22&rnum=3#009395e3234a3dbc
>
> I think I have a link at the bottom of that post, which refs a MS KB article
> about the "why".
Isn't it just a problem in .NET 1.0 and 1.1 but not in 2.0 and later?
The KB article that is pointed to in the thread you posted says those
are the versions the bug applies to, but I wonder if it was written
before .NET 2.0 was out?
http://support.microsoft.com/kb/842793
--
-glenn-
Date:Wed, 08 Aug 2007 11:47:04 -0400
Author:
|
|
|