[Lazarus] TThread.Queue vs Application.QueueAsyncCall
nc-gaertnma at netcologne.de
Tue Jul 18 13:50:23 CEST 2023
On 17.07.23 19:01, Luca Olivetti via lazarus wrote:
> TThread.Queue and Application.QueueAsyncCall more or less do the same
> thing (even if they use two different queues that are managed at
> different times in the main thread).
> When it's better to use one or the other?
Application.QueueAsyncCall has a Data: PtrInt parameter to pass some
context and it is always called later, so this is useful for doing
something after the current LCL event.
TThread.Queue has aThread parameter, so the call is removed when the
thread is freed, and when you call it from the main thread it will
execute immediately, so this is for worker threads to asynchronously do
something in the main thread.
More information about the lazarus