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!

Basicaly I have one form MyForm with one background thread, which every 10 sec. checks for files in shared folder and adds them to listbox visible to user:
procedure TRefreshFileListThread.Execute;
begin
  while not Terminated do begin
Synchronize(@MyForm.UpdateFileList); // UpdateFileList is method which clears listbox and then adds files in given shared folder
    Sleep(10000);
  end;

When new file is shown then user can click on button, which imports data from this file: Before import is shown another form with question about "Do you want really import file XYZ ?"

Do you say, that when this "question form" is shown it can release call to MyForm.UpdateFileList ?
Now I did quick test and it seems, that it is so!

But is it correct behavior ? IMO it is against thread safety, which should Synchronize guarantee! While "main thread" is executing others threads should wait in queue ... if not fixable, then can it be documented?, because this is exception which is not intuitive

-Laco.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to