[Lazarus] TThread.Synchronize
Michael Schnell
mschnell at lumino.de
Tue Oct 25 13:34:17 CEST 2016
On 25.10.2016 13:21, LacaK via Lazarus wrote:
> My understanding is that, Synchronize schedules execution of
> MyForm.MyMethod to main thread, so method is not executed until
> control is returned from event handler in MyForm. Right?
TThread.Synchronze pushes the procedure that is given as a parameter
(including it's Self pointer) to the event queue and then the Therad
that called TThread.Synchronize is stalled. Some time later the main
(GUI) thread will execute the scheduled procedure. When this call
returns, the thread that called TThread.Synchronize is activated.
There also is TThread.Queue that works identically, only without
stalling the thread.
> But in my case happens, that method is executed while execution of
> event handler does not finished yet ... is it expected behavior ?
What is "that method"? If same is called by the thread after
TThread.Synchronize, IMHO this can't be correct.
-Michael
More information about the Lazarus
mailing list