Re: [AD] minor fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Elias Pschernig wrote:

TIMERS_PER_SECOND.. that's some constant derived from some PC timer
component, which is used as timebase for the Allegro timers. But what
does it have to do with unix scheduling? And INT_MAX.. wth has the value
of INT_MAX to do with it? heh.. at least there should be a comment for
such magic constants :P

Yeah, it doesn't make any sense to me.  Let's see:

   INT_MAX = 2147483647
   TIMERS_PER_SECOND = 1193181
   INT_MAX/(TIMERS_PER_SECOND/100) = 179991

Since `interval' is in microseconds:
   179991us = 179.991ms ~= 18 x 10ms

which means `i' won't be clamped unless select() blocks for about 18 times longer than we asked for. I can't see that happening, except when you suspend the process then bring it back (or something similar). The size of the clamp is probably arbitrary then.

Anyway, the goal is to call the callbacks at an average rate of 100 times per second. Whether the current code does that is for someone else to investigate :-)


It does. I made it print the number of calls in one second, and there's
lots of 99 and 98, some 97, and even one 100 :)

It probably just works because of select() waiting the right amount of time rather than anything clever on our part.

Maybe in xwin.x there's another timing
to decided how much to process (and of course I remember the only-4-
events-at-once - might try upping that some time and see how expal
reacts).

Ah, yes, that patch I kept putting off.

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/