Re: Another Tricky Problem I am Messing With (Not Homework)



Miguel Guedes wrote:

<snip>
{
target = clock() + (clock_t)(timer*(float)CLOCKS_PER_SEC);

while(clock() < target);

Although this is a standard conforming way to wait for a certain time
period, it is actually not a very friendly way on a multi-user system.
This loop probably consumes 100% CPU time while it is doing nothing.

For this kind of task, it is advisable to look for a implementation
specific method. Functions like Sleep (Windows) and sleep/usleep (unix)
come to mind.

Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/
.



Relevant Pages

  • Re: Difference between .NET Framework and .NET Compact Framework
    ... Your best target for .NET CF questions is ... Here's a link to the FAQ: ... > Here is quote from MSDN: ...
    (microsoft.public.windowsce.app.development)
  • More things for writing new CPU ports.
    ... What should I do for implement Linux kernel on a new CPU and target ... I just read FAQ but it's just general information. ...
    (Linux-Kernel)
  • Re: OpenBSD release cycle
    ... > From FAQ 1.7: ... > "The OpenBSD team makes a new release every six months, with target ... Though a central "Roadmap" link on the webpage wouldn't hurt... ...
    (comp.unix.bsd.openbsd.misc)
  • Re: Ride-by Attack
    ... >> closest space to your target? ... this was like one of the first questions in the 3.5 FAQ. ... > you can just ride past someone instead of at them when you use Ride By ... We used this one time only with a dragon instead of a horse ...
    (rec.games.frp.dnd)
  • Re: C objects
    ... >>Please cite an example of a standard conforming C compiler ... > Amazing what you can find by reading the FAQ. ... a "standard conforming C compiler". ...
    (comp.lang.c)