[fpc-pascal] Timer in X11

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Dec 22 10:39:55 CET 2011


On 21 December 2011 18:26, Felipe Monteiro de Carvalho <...> wrote:
>> just spinning around a loop, so even if your app isn't active, it's still
>> waking up every 50ms.  I don't consider this very good programming practice.
>
> I tested with top and it doesn't even show my application in the top
> 20 users of CPU.

I was just about to mention that, and would have been very surprised
if it did show CPU usage. I have always been careful with CPU usage in
fpGUI's event loop.


> It now adjusts the interval acoording to the installed timers, up to a
> maximum of 1 second.

Initially I thought that sounded like a good idea - but doesn't in now
do even more processing that without the GetSmallestTimerInterval()
function? Doing the timer loop, a math comparison for each timer etc.
But realistically it should still hardly register as a blip in the CPU
usage, so I guess it should be fine - especially if only one or so
timers are ever used in a application.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net



More information about the fpc-pascal mailing list