Mail Archives: djgpp/2000/02/02/16:52:38
> > I situated the rest_callback() call inside function foo(), making sure
it
> > wasn't repeated more than once...
> I don't undstand that last line. If 'rest_callback()' is inside of
> 'foo()', and it is called as 'rest_callback(time,foo)', you are going to
get
> infinite recursion.
No, as I implied before, I prevented that, by an if() statement:
int rest=0;
void foo(void)
{
int time=1;
if (!rest)
{
rest=1;
rest_callback(time, foo);
rest=0;
}
}
> > If I set [time=1] and ran the program, it went really really slow...
> >
> > But It can't have been because of the foo() function being too slow,
> > because, when I tried to replace rest_callback(1,foo) with foo(), it got
> > gigantically faster immediately...
>
> 'time' is not how many times to run it, it is how LONG to run it, so
> rest_callback(1, foo) should take about 0.001 seconds regardless of the
speed
> of foo, (as long as it is reasonably speedy), because it is being called
many
> times.
I am aware of that. That's why I think one millisecond wouldn't last for
half a second or something in that style...
And I know my routine is speedy enough, because it goes a lot faster when I
try replacing the rest_callback(time,foo) with foo(), but because I want it
to wait exactly that amount of time, I will have to use that routine...
So, any ideas to why rest_callback seemingly doesn't work?
Regards,
Erik Anell
- Raw text -