[Lazarus] TThread.Synchronize

Michael Schnell mschnell at lumino.de
Wed Oct 26 13:09:23 CEST 2016



On 26.10.2016 12:02, LacaK via Lazarus wrote:
>>
>>  you just could use TTimer.
> probably yes. I do not remember why I have used thread for it. May be 
> I do not wanted dependency on ExtCtrls ...
> Btw. when TTimer is executing OnTimer method, which does not finishes 
> until next Interval is elapsed, is again called OnTimer ? Or next 
> OnTimer is performed only when prior OnTimer finished ?
>
Using a "Worker" Thread makes sense when
  - long winding stuff (calculations, file search, database, ...) are 
done in the Thread and the GUI is supposed to go on working during that time
  - you want to take advantage of multiple cores working in parallel 
(e.g. for number crunching)
  - you want to wait for external events in a blocking OS Call (e.g. 
Socket).

I would avoid using Threads if not decently justified, as a lot 
complexity is added.

-Michael


More information about the Lazarus mailing list