Re: [AD] minor fix

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


Elias Pschernig wrote:

Btw, reading through uthread.c, I came up with the attached patch,
hopefully saving a lot of confusion to the next person reading it (not
that I'm not still uncertain what 'interval' is for).


`interval' is the amount of time passed between the current iteration of the while-loop and the last iteration. We're supposed to call the callbacks some number of times, depending on how big that interval actually is (it can depend on how long select() blocks for and how long the callbacks run for, and maybe on the overhead of the mutexes).

I think I've figured out what happened with the code at the top of the while-loop. It traces back to usigalrm.c (written by Michael and present in v3.9.32), where the `i = i * (TIMERS_PER_SECOND/100) / 10000L;' line is actually not useless. I must have copied out that chunk and not thought about it more.

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 :-)

This superfluous
line also makes me think that whoever wrote the original function and
put the 10000 in there wasn't too sure what is going on :)

It appears you're right about that.

Peter




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