[fpc-pascal] TThread.Queue vs TThread.Synchronize

Michael Schnell mschnell at lumino.de
Wed Feb 25 10:09:42 CET 2015

On 02/24/2015 04:38 PM, Marco van de Voort wrote:
> In our previous episode, Michael Schnell said:
>> On this behalf, "Application.QueuAsyncCall" is more versatile.
>> But it's easy with TThread.Queue, as well.
>>    - define  a class (not to be derived from TThread) that holds the data
>> to be transferred and a procedure without parameters
>>    - create an instance of that class
> (where to store that instance?)
Nowhere, it is implicitly "stored" via the self-pointer of the argument 
when calling TThread.Queue)
>>    - use TThread.Queue to have the said procedure be executed by the main
>> thread
>>    - at the end of the said procedure do "free" (without a prefix) this
>> will make the instance remoce itself.
> You need a full queue for that, since the mainthread might not run till the
> thread next queue()'s.
The fpc RTL does implement a full blown queue for managing TThread.Queue 
and TThread.Synchronize.


More information about the fpc-pascal mailing list