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

Henry Vermaak henry.vermaak at gmail.com
Fri Jul 1 18:27:28 CEST 2016


On Fri, Jul 01, 2016 at 05:47:58PM +0200, Michael Van Canneyt wrote:
> 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.

It should be thread safe (see lazarus r31143).  Works OK for me when
called from threads.

Henry



More information about the fpc-pascal mailing list