On Mon, 4 Oct 2021, Bo Berglund via fpc-pascal wrote:
On Mon, 04 Oct 2021 12:46:32 -0400, Dennis Lee Bieber via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:
COMMENT: here you ask about a non-GU /service/ application, but in your
prior post you gave a code snippet. It may just be a documentation flaw,
but...
-=-=-
{ function to be called when gui thread is ready to execute method
result is true if a method has been executed
}
function CheckSynchronize(timeout : longint=0) : boolean;
var
{ method proc that is called to trigger gui thread to execute a
method }
WakeMainThread : TNotifyEvent = nil;
My program in Lazarus *is* a "simple program" and it has no GUI components.
I never even looked at the implementation of CheckSynchronize()...
It was just given in another thread when I was working on the port from Delphi
to Linux and thus from the Windows GUI environment to the non-GUI command line
program environment.
The name 'Gui thread' is misleading. It's simply the main program thread.
If you want to use TThread.Synchronize then the call to CheckSynchronize is
needed. The LCL for GUI application simply calls it automatically for you.
In a non-GUI command-line program, you're responsible for calling it from
time to time.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal