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.
ok
Some time later the main (GUI) thread will execute the scheduled
procedure. When this call returns, the thread that called
TThread.Synchronize is activated.
ok
but what is relation between "main thread" and this "sheduled procedure"
? Can "sheduled procedure" jump into execution while main thread is
still executing prior called form method ?
There also is TThread.Queue that works identically, only without
stalling the thread.
yes, but I do not want this
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.
Yes this can happen.
MyForm.MyMethod is called also from event handler and also is used in
Synchronize(@MyForm.MyMethod)
How can this happen/play role?
I have suspection that somewhere in Win32 widgetset is called
CheckSynchronize as reaction on some message or so, which releases
execution of MyForm.MyMethod ... but it is inappropriate, does not ?
-Laco.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus