On 06/26/2014 03:54 PM, Mattias Gaertner wrote:
Application.ProcessMessages calls CheckSynchronize and calls the
queued async calls. Under nogui that's all.
Here the waiting and sleeping mechanism is lacking.

Application.ProcessMessages supposedly calls CheckSynchronize with the Timeout set to 0.

The timeout is critical for me, as it is used to implement TTimer.

In my Application CheckSynchronize always is called with the Timeout set to a non zero Value.

TThread.Queue in the end calls WakeMainThread() to wake the main thread (i.e. terminate the CheckSynchronize call waiting for a timeout).

I did not yet find any lower level non private queue-feed functionality usable instead of TThread.Queue.

Other widgetsets process
the widgetsets events as well.
They implement a second queue besides the one the RTL implements for TThread.

A LCL program calls Application.Run, which is a loop calling
Application.ProcessMessages. You can create sub loops. A common example
is TForm.ShowModal, which also calls Application.ProcessMessages.
Or you can do your own loop, in which case you have to call it yourself.

If you call CheckSynchronize instead of Application.ProcessMessages you
simply omit the widgetsets and queued async calls.
Other "active" LCL Widget Types call CheckSynchronize with Timeout set to Zero and implement their own arch depending waiting mechanism, as they are greatly arch depending anyway. My tiny Application not inherently arch depending implementation just uses CheckSynchronize to do the waiting (e.g. for TTimer) and hence does not an arch depending implementation for this.

-Michael

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to