[DUG]Timers

Matthew Comb matt at ferndigital.com
Tue Mar 7 12:02:46 NZDT 2006


Carlos' code looks good and synchronizes the time event with the main thread.

Be aware though that the thread timeout in these components does not take
into account how long it took to execute the event.

In johns case if his code executed took 20 seconds for example, and the
resolution on the timer is 30 seconds, then the combined resolution would
be 50 seconds.

If resolution is really important, you would be better to segment your
timer code in another worker thread.

This doesn't matter much if the event code is negligable.

Matt.


> Try Carlos Barbosa's free TThreadedTimer components, it's great, I have
> been using it for a while. It's freeware, runs in a separate thread and
> has a higher resolution than the standard timer component according to
> the author.
>
> http://www.carlosb.com/ (Free Delphi and C# Components -> Delphi ->
> Threaded Timer)
>
> John Bird wrote:
>> If I have two timers active in a program, and occasionally one of them
>> takes
>> a while to execute its code, does it hold up the other timer from firing
>> until it is done?
>>
>> Or phrased another way can I think of two timers as if running in
>> separate
>> threads, or in the same thread, so that one finishes before the other
>> can
>> get a chance to run.
>>
>> The reason I am wondering is if there are any issues to be careful of in
>> modifying variables shared between the two timers.
>>
>> John
>>
>> _______________________________________________
>> Delphi mailing list
>> Delphi at ns3.123.co.nz
>> http://ns3.123.co.nz/mailman/listinfo/delphi
>>
>>
>>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>




More information about the Delphi mailing list