delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/02/15:10:02

From: "Campbell, Rolf [SKY:1U32:EXCH]" <moscoop AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: too slow to be true: rest_callback .
Date: Wed, 02 Feb 2000 13:30:23 -0500
Organization: Nortel Networks
Lines: 28
Message-ID: <389877BF.E944EDEC@americasm01.nt.com>
References: <1UYl4.4586$al3 DOT 57398 AT newsc DOT telia DOT net>
NNTP-Posting-Host: wmerh0tk.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.71 [en] (X11; I; HP-UX B.10.20 9000/785)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019