Click here to Skip to main content
16,004,887 members
Home / Discussions / C#
   

C#

 
GeneralRe: question about Timer Tick event Pin
likefood25-Aug-06 14:47
likefood25-Aug-06 14:47 
GeneralRe: question about Timer Tick event Pin
Subby Dev25-Aug-06 14:39
Subby Dev25-Aug-06 14:39 
GeneralRe: question about Timer Tick event [modified] Pin
likefood25-Aug-06 14:48
likefood25-Aug-06 14:48 
AnswerIt is probably hardware specific Pin
Ennis Ray Lynch, Jr.25-Aug-06 17:29
Ennis Ray Lynch, Jr.25-Aug-06 17:29 
GeneralRe: It is probably hardware specific Pin
likefood25-Aug-06 17:47
likefood25-Aug-06 17:47 
AnswerRe: question about Timer Tick event Pin
Robert Rohde25-Aug-06 21:30
Robert Rohde25-Aug-06 21:30 
GeneralRe: question about Timer Tick event Pin
likefood26-Aug-06 13:31
likefood26-Aug-06 13:31 
AnswerRe: question about Timer Tick event Pin
Mike Dimmick26-Aug-06 2:34
Mike Dimmick26-Aug-06 2:34 
System.Windows.Forms.Timer is based on the WM_TIMER message with all of its associated limitations. Significantly, it is the lowest priority event of all, after painting the window. Any other message handlers which take a significant time will hold up the processing of the timer event. The system will post another timer event after the time has elapsed after the previous one was processed. The resolution of the timers is the same as the system timer tick, which on Windows XP is 15ms. On Windows 98 it is 55ms IIRC.

I don't really get on with System.Threading.Timer. Its behaviour is to fire events on the threadpool, and it has no locking to prevent the events being fired concurrently - if your first handler hasn't completed, the thread pool will (if threads are available) run it again, concurrently, on another thread. I believe the timer resolution is the same as for System.Windows.Forms.Timer. Because it runs on the threadpool, it's unsafe to run any GUI code in the handler.

System.Timers.Timer is based on System.Threading.Timer. If you set the SynchronizingObject property, the callbacks are fired synchronously on the correct thread for that object, so the limitations above don't apply - it is safe to run GUI code, and callbacks cannot occur concurrently.

For the resolution you're after, you probably need a multimedia timer. This actually tweaks the system timer resolution. See this article[^] for a C# wrapper around the multimedia timer APIs. I haven't tried this code out, so I can't make any claims for it.

Stability. What an interesting concept. -- Chris Maunder

GeneralRe: question about Timer Tick event Pin
likefood26-Aug-06 13:47
likefood26-Aug-06 13:47 
GeneralRe: question about Timer Tick event Pin
Mike Dimmick26-Aug-06 14:32
Mike Dimmick26-Aug-06 14:32 
GeneralRe: question about Timer Tick event [modified] Pin
Mike Dimmick27-Aug-06 11:00
Mike Dimmick27-Aug-06 11:00 
GeneralRe: question about Timer Tick event Pin
likefood27-Aug-06 12:50
likefood27-Aug-06 12:50 
QuestionDateTime format Pin
kani9825-Aug-06 11:55
kani9825-Aug-06 11:55 
AnswerRe: DateTime format Pin
Ravi Bhavnani25-Aug-06 12:18
professionalRavi Bhavnani25-Aug-06 12:18 
AnswerRe: DateTime format Pin
drdavef25-Aug-06 12:29
drdavef25-Aug-06 12:29 
AnswerRe: DateTime format Pin
AnshShar25-Aug-06 12:43
AnshShar25-Aug-06 12:43 
AnswerRe: DateTime format Pin
Scott Dorman1-Sep-06 13:29
professionalScott Dorman1-Sep-06 13:29 
Questioncan someone help plz: threading the PingReply Pin
Jassim Rahma25-Aug-06 8:30
Jassim Rahma25-Aug-06 8:30 
AnswerRe: can someone help plz: threading the PingReply Pin
Not Active25-Aug-06 8:43
mentorNot Active25-Aug-06 8:43 
QuestionC# ::: receive FAX Pin
Yetinger25-Aug-06 8:21
Yetinger25-Aug-06 8:21 
AnswerRe: C# ::: receive FAX Pin
Nader Elshehabi25-Aug-06 10:29
Nader Elshehabi25-Aug-06 10:29 
GeneralRe: C# ::: receive FAX Pin
Yetinger25-Aug-06 22:29
Yetinger25-Aug-06 22:29 
AnswerRe: C# ::: receive FAX Pin
Nader Elshehabi26-Aug-06 0:59
Nader Elshehabi26-Aug-06 0:59 
AnswerRe: C# ::: receive FAX Pin
Yetinger27-Aug-06 5:28
Yetinger27-Aug-06 5:28 
QuestionCrystal Reports and Windows Applications Pin
ebonaba25-Aug-06 7:59
ebonaba25-Aug-06 7:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.