On 21/12/11 12:36, Mark Morgan Lloyd wrote:
Henry Vermaak wrote:
On 21/12/11 11:06, Felipe Monteiro de Carvalho wrote:
Hello,

Does anyone know what would be the solution for implementing timer
support in a X11 toolkit? I already have TTimer support implemented
for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the
best tested of them), but it looks like X11 has no support for timers,
so I wonder what the best approach would be to solve this.

Roll your own event loop by calling select() on the XConnectionNumber
(which is a file descriptor). You can then use the select() timeout,
or use timerfd* functions under linux. Google around to find examples.

Presumably with the usual health warnings on whether select() updates
its parameters. As far as I could tell when hacking serial.pp, Linux
does but Solaris (8, 10) doesn't.

Indeed. It seems like relying on this is not a good idea. So then using timer_create with pselect is probably the most portable approach.

Henry
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to