[fpc-pascal] Timer in X11

Martin Schreiber mse00000 at gmail.com
Wed Dec 21 21:08:06 CET 2011


On Wednesday 21 December 2011 20:10:49 Marco van de Voort wrote:
>
> I've been thinking about this myself, and if you don't want bad timers, the
> most logical route would be to write a scheduler implementation where the
> scheduler
>
> 1) in principle waits till the next registered event (events can be
> periodical)
> 2) the wait can be broken (e.g. when a new event is registered, which could
> theoretically fire before the current wait) because it also blocks on some
> event. (waitmultiple on sources + tevent on Windows, select on events +
> pipe on *nix)
>
MSEgui timer implementation works approximately like that. On Linux it uses 
libc setitimer() with microseconds resolution to setup the wait time until 
the next event, on Windows either settimer() or mmtimer timesetevent() if 
better resolution is necessary.

Martin



More information about the fpc-pascal mailing list