Mail Archives: djgpp/2000/02/02/15:10:02
Erik Anell wrote:
> Hello,
> When I try to use rest_callback(time,foo) (it should repeatedly enter void
> foo(void) until <time> milliseconds has passed)
> 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.
> 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.
--
(\/) Rolf Campbell (\/)
- Raw text -