Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

System.Threading.Timer period erratic

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Oxns - 06 Jan 2006 17:13 GMT
Hi,

I have a system with a number of system.threading.timers. These are set to
fire every (say 200 milliseconds). If the thread has little work to do, the
timer fires again at the correct time BUT if the thread does a lot of work,
the next firing is delayed by some xx milliseconds.

Is there something in the timer code which prevents the timer period from
being reset until the delegate finishes ???. If so what is the best way
around this problem as I need timers to fire accurately at their specified
intervals.

NB I am using a system.diagnostics stopwatch to log the timer timings - so
could this also be an issue ???.

Thanks

Regards

Graham
Kevin Spencer - 06 Jan 2006 18:03 GMT
You shouldn't have to reset the timers, unless the Interval changes. Just
set the AutoReset property to true.

Signature

HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

> Hi,
>
[quoted text clipped - 16 lines]
>
> Graham
Willy Denoyette [MVP] - 06 Jan 2006 19:33 GMT
| Hi,
|
[quoted text clipped - 16 lines]
|
| Graham

Windows is not a real-time OS, so there is no guarantee that the event will
fire at the exact interval you specified, another thread in the system may
run at a higher priority currently blocking delivery of timer events to your
application. When that happens the event will be delayed, the event may even
get lost especially when using short intervals like 200 msec.

Willy.
Oxns - 07 Jan 2006 09:44 GMT
Willy,

Thanks for the reply - I understand the limitations of Windows - in fact I
am seriously considering an embedded hardware solution with a REAL RTOS
(Forth) for this application ;-)).

I still would however expect the timer period to remain accurate, even if
some ticks start late (as they were blocked), I would expect these to
recover, but the effects appear to be cumulative :-(( - when one is delayed
the next also appears to be delayed - hence my question about when the timer
tick actually gets reset.

I'm also used to embedded systems for many years and would always ensure
that the first thing an interrupt handler often does is to reset its source.

Thanks agin though.

Graham

> | Hi,
> |
[quoted text clipped - 33 lines]
>
> Willy.
"Peter Huang" [MSFT] - 09 Jan 2006 04:56 GMT
Hi Oxns,

As Willy said, Windows NT family is not designed to be a RTOS.
Here is a link for your reference.
http://www.omimo.be/magazine/97q2/winntasrtos.htm

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.