From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Strange behaviour of delay in Windows XP
Date: Sat, 9 Oct 2010 01:42:54 -0500
Date: 2010-10-09T01:42:54-05:00 [thread overview]
Message-ID: <i8p2tf$cl9$1@munin.nbi.dk> (raw)
In-Reply-To: i8mag8$egc$1@news.eternal-september.org
"michael bode" <m.g.bode@web.de> wrote in message
news:i8mag8$egc$1@news.eternal-september.org...
...
>> It wouldn't be hard to do something in an implementation of "delay" that
>> caused a time explosion in some case or another.
>
> Does a relative delay do more than call something like usleep(3) or
> whatever is the corresponding Win32 API?
I'd expect that to be compiler-specific. I would guess that many compilers
would turn it into some form of delay until.
But just calling Sleep in the Win32 API is usually where the problems come
from; you can't just call it it with any old value because it rounds it up
to 0.1s. So I could imagine an implementation that for whatever reason
decided to split up the Sleep calls (maybe to poll something else) could get
in real trouble. In your case, if it chopped the 1.0s into 270 Sleep calls
for some reason, you'd get the behavior you see. That could happen if the
programmer(s) wasn't familar with the oddball behavior of Win32 Sleep.
In Janus/Ada, I had to write code to busy-wait if the delay time is less
than 0.1s; we only call Sleep if the delay time is longer. (That doesn't
always work right, either, but I'm not quite sure why.)
Randy.
next prev parent reply other threads:[~2010-10-09 6:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 21:04 Strange behaviour of delay in Windows XP michael bode
2010-10-07 21:35 ` Vinzent Hoefler
2010-10-07 22:10 ` michael bode
2010-10-07 22:37 ` Jeffrey Carter
2010-10-08 5:18 ` michael bode
2010-10-08 10:13 ` michael bode
2010-10-08 0:15 ` Randy Brukardt
2010-10-08 5:33 ` michael bode
2010-10-09 6:42 ` Randy Brukardt [this message]
2010-10-09 8:18 ` Dmitry A. Kazakov
2010-10-26 1:50 ` Yannick Duchêne (Hibou57)
2010-10-08 7:54 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox