Which timer to use ? | Sololearn: Learn to code for FREE!

+1

Which timer to use ?

I like to do something every 100 ms. The timer seems to work fine until you count the times it fires. 450 instead of the expected 600. I did expect some inaccuracy but this is a lot. I am using a dispatcher timer because there is some UI work in there too, I can separated that from the things that I really wanted to do, but I want to know. Is there a timer that is better than the dispatcher-timer ? What timer would you use ?

8/8/2022 6:22:12 PM

sneeze

1 Answer

New Answer

+2

Maybe something make the dispatcher thread busy sometimes and i think that some optimizations must be made .. Anyway try also to set the timer as Send priority https://docs.microsoft.com/en-us/dotnet/api/system.windows.threading.dispatcherpriority?redirectedfrom=MSDN&view=windowsdesktop-6.0