[Lazarus] Using Lazarus for non-graphical apps

Michael Schnell mschnell at lumino.de
Tue Jan 7 15:22:36 CET 2014


On 01/07/2014 03:11 PM, Michael Van Canneyt wrote:
> WakeMainThread may or may not be implemented. You should not count on 
> that.

Right you are.

If you want to have "decent event oriented Pascal programming" (i.e. by 
using TThread.Synchronize and/or TThread.Queue for handling the issues 
the OP requested such as doing blocking I/O in Threads), you need to do 
an environment (which can be seen as a "WidgetType" in Lazarus speak) 
that calls CheckSynchronize in the main thread and that implements 
WakeMainThread to wake the main thread (idle while waiting for a timeout 
in CheckSynchronize) by means of the underlying OS.

TTimer can be implemented on top of that as a Graeme "ThreadTimer" or by 
other means (I intend to provide a very rough TTimer variant based on 
the CheckSynchronize timeout).

-Michael




More information about the Lazarus mailing list