[Lazarus] TThread.Synchronize
Michael Van Canneyt
michael at freepascal.org
Wed Oct 26 08:31:25 CEST 2016
On Wed, 26 Oct 2016, LacaK via Lazarus wrote:
>
>>
>>>
>>>> Check for Application.ProcessMessages and CheckSynchronize calls.
>>>> These process synchronize queue, if I am not mistaken.
>>>
>>> I do not call CheckSynchronize nor ProcessMessages in my application.
>>> So only any LCL component or widget set can call it in background ?
>>
>> ShowModal() for a modal form will call it.
>
> Ah really?
> It happens in my application!
Then that is your problem.
> But is it correct behavior ? IMO it is against thread safety, which
> should Synchronize guarantee!
The two issues are completely unrelated. The current behaviour is correct.
Nowhere is it stated or guaranteed that synchronisation cannot happen in a GUI event
handler. Any code at any time can call the GUI message loop. A modal form is
just one instance. Your code must be able to deal with this.
Michael.
More information about the Lazarus
mailing list