[Lazarus] TThread.Synchronize

LacaK lacak at zoznam.sk
Wed Oct 26 10:27:45 CEST 2016


Big Thanks to all. Now I understand what is happening ... probably I wil 
use critical section to block access from thread when code in main 
thread is performed ...
-Laco.

>
>>>>> ShowModal() for a modal form will call it.
>> [...]
>> I did test in Delphi and Delphi seems also perform synchronize upon
>> ShowModal
> Yes.
>
>
>>> Nowhere is it stated or guaranteed that synchronisation cannot happen
>>> in a GUI event
>>> handler.
>> But cann't happen if nobody calls ProcessMessages or CheckSynchronize
>> explicitly.
>> So if user code is executed in event handler then this execution cann't
>> be interrupted by thread waiting for "synchronization"
> Yes.
> Unless you call something that does call HandleMessages/ProcessMessages
> or CheckSynchronize.
>
>   
>>> Any code at any time can call the GUI message loop. A modal form is
>>> just one instance.
>> ModalForm is IMO one example but may be alone in LCL ... as there are no
>> more controls which do same, does not ?
> The dialogs like TOpenDialog and ShowMessage call it.
> Another example is reading the Clipboard on gtk and retrieving files in
> TShellTreeView.
>
>
> Mattias


More information about the Lazarus mailing list