[fpc-pascal] What is the difference between TThread.Queue(aMethod: TThreadMethod) and Application.QueueAsyncCall(AMethod: TDataEvent; Data: PtrInt);

Michael Van Canneyt michael at freepascal.org
Fri Jul 1 17:47:58 CEST 2016



On Fri, 1 Jul 2016, Dennis wrote:

> Apart from the TThreadMethod and TDataEvent, what are the major differences?
> Are both of them thread safe to call from non-main thread?
> Will both of them overwrite some queue or buffer if the queues are full?
>
> I tried to study the source code but I cannot find the implementation parts.
> I only find the interface parts of TThread classesh.inc

To the best of my knowledge:

Application.QueueAsyncCall has nothing to do with threads. 
This is an LCL method which can be used to insert a callback in the message loop.
I think it unlikely that this is thread-safe, I suspect it is only for the
main thread.

TThread.Queue schedules a call for execution in the main thread. 
It is meant for use in other threads.

Michael.



More information about the fpc-pascal mailing list