[Lazarus] Event created by program logic rather than user
Lukasz Sokol
el.es.cr at gmail.com
Tue Nov 10 16:00:29 CET 2015
On 10/11/15 12:23, Michael Schnell wrote:
> On 11/10/2015 01:14 PM, Engelbert Buxbaum wrote:
>>
>> as far as I can see the only advantage of running the math-routine
>> in a thread would be that the program could be terminated at any
>> time, rather than only in the main loop.
> If a long winding calculation runs in a Thread, the complete main
> thread (including the GUI) is not blocked and the program can do any
> other stuff (e.g. as a reaction on TTimer events, and also as a
> reaction on Events this or any other thread fires via
> TThread.Queue).
>
I'd just add, but,
> Moreover on a multi-CPU system (which is standard nowadays), multiple
> threads can do long winding calculations at the same time and finish
> by far faster than a single threaded program.
>
- this, only if the calculation itself is possible to be multithreaded
(e.g. formula possible to calculate in chunks/portions/arbitrary bounds etc).
>
>>
>> Even if one did it like that, the original problem remains: who is
>> the sender in the FormPaint call?
> As any GUI stuff is only allowed in the main thread it can only be
> the Main thread (if this is what you are asking)
>
> -Michael
>
el es
More information about the Lazarus
mailing list