[fpc-devel] Strange behaviour with Synapse

Michael Schnell mschnell at lumino.de
Mon Mar 18 12:11:44 CET 2013


On 03/17/2013 09:05 AM, Ludo Brands wrote:
> you create a string for the GUI, synchronize to update the screen, 
> call Application.Processmessages to make sure the GUI gets updated.
I would suggest to do those GUI updates by QueueAsyncCall() or 
TThread.Queue() (TThread.Queue uses the same syntax as Synchronize and 
thus is rather easy to use in your case (beware of string references, 
though), but it might be present only in the svn version of fpc as  it 
is rather new (because it has been existing but not documented in Delphi 
until rather recently. )

TThread.Queue works like TThread.Synchronize, but does not stall the 
thread until the mainthread has done the requested action. Thus, if no 
result is to be reported back or mutual access problems are lurking, it 
is is a lot better than Synchronize: The thread keeps running and no 
performance-eating ProcessMessages is necessary.

QueueAsyncCall does the same, is more versatile but uses different 
Syntax and is not available in Delphi.

( PostMessage /  procedure ... message does the same, is available and 
documented in Delphi, but uses very ugly fake-Windows syntax, even if 
used in Linux.  )

-Michael



More information about the fpc-devel mailing list