![delphi thread as timer delphi thread as timer](https://pbs.twimg.com/media/DuFO7THWsAA9hoA.jpg)
This is the highest resolution timing i'm aware of on Windows based PCs. That’s why the real solution for background operations that will keep the UI thread responsive is to use a thread.
![delphi thread as timer delphi thread as timer](http://i.ytimg.com/vi/P3B99AqHr7U/maxresdefault.jpg)
Delphi thread as timer android#
In this respect, Android is not much different than Windows. If you are wondering why it doesn't return a value of exactly 1 (It should be around 0.99.) for the elapsed time, that is because Sleep is not accurate enough to sleep for exactly one second, not because the measurements are incorrect. The issue is that the timer event handler is execute in the context of the main thread, the UI thread, the only thread that processes user interaction. The sleep is just for demonstration purposes. For example, the following code waits for another thread to fill a thread list object. Use the WaitFor method of the other thread. Check if another thread is waiting for your thread to terminate.
![delphi thread as timer delphi thread as timer](https://www.codeproject.com/KB/tips/1060345/SampleApplication2.png)
Just dump this code into a TButton.OnClick event a make sure you've got some labels on the form to get an idea of what's going on. The following are procedures that can be used to wait for threads. Label5.Caption:='Elapsed Time = '+FloatToStr((E-S)/F) Label4.Caption:='End - Start = '+IntToStr(E-S) You are probably already familiar with the NSTimer on. Label1.Caption:='Frequency = '+IntToStr(F) Using the Apples Grand Central Dispatch and Androids ScheduledThreadPoolExecutor for Delphi timers. Sleep(1000) //Do something interesting here rather than just go to sleep With regards to your problem, I can't recommend a component but I can recommend a method of attaining high resolution timings.