If you want a busy loop, just comment out the sleep line. I don't see how that makes any sense, though.

Of course, it can, if you use a HiRes timer.

You have to use a timer either way. Or is hires somehow meaningful in that sentence? I don't see why, so could you give a example reason?

there *are* cases where it makes more sense

What would be such a case? I can't think of an example where doing a busy loop is acceptable if the system has a notification API. (In this case, sleep is that API since we're only interested in waiting for an amount of time.)


In reply to Re^4: do something no more than 3 times a second by ikegami
in thread do something no more than 3 times a second by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.