[Lazarus] TThread.WaitFor blocks the main event loop under Linux

Sergei Gorelkin sergei_gorelkin at mail.ru
Fri Oct 8 15:56:20 CEST 2010


Graeme Geldenhuys wrote:

> ...
> Did anybody know about this? Anybody know how we can get
> TThread.WaitFor to actually work under Linux/Unix?
> 
It is the same old song: absense of centralized event handling in Linux.
In Windows, the main thread waits with MsgWaitForMultipleObjects, so it remains capable of 
processing messages, no matter where they come from.
In Linux, there's no centralized event source, so one always has to specify particular source(s) 
(For GUI apps, it will be X event socket). In well-known toolkits, this is handled by "Main loop" 
(e.g. GMainLoop in glib).
So to get it working, one needs either to implement something similar to GMainLoop in RTL, or 
implement some mechanism that can hook into an external "main loop" which, in case of GUI 
application, will be provided by GUI toolkit.


Regards,
Sergei




More information about the Lazarus mailing list