delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/02/16:52:38

From: "Erik Anell" <pintie AT telia DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <1UYl4.4586$al3 DOT 57398 AT newsc DOT telia DOT net> <389877BF DOT E944EDEC AT americasm01 DOT nt DOT com>
Subject: SV: too slow to be true: rest_callback .
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <3H0m4.4654$al3.58267@newsc.telia.net>
Date: Wed, 02 Feb 2000 20:44:47 GMT
NNTP-Posting-Host: 62.20.145.109
X-Complaints-To: abuse AT telia DOT com
X-Trace: newsc.telia.net 949524287 62.20.145.109 (Wed, 02 Feb 2000 21:44:47 MET)
NNTP-Posting-Date: Wed, 02 Feb 2000 21:44:47 MET
Organization: Telia Internet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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


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