I had thought to post this a few weeks ago, but I thought it was too silly. However having seen a few similar queries go past, it seems reasonable.
It seems there is no perl command that causes perl to give up the remains of it's timeslice. Languages like Visual Basic have some kind of "do_events" call (in fact I think it's a windows API).
When this is called, the program finsihes it's allocated timeslice early, handing it over to the kernel to be spent as needed somewhere else.
This is fantastic for those moments when you just want to check something as often as possible, as long as it doesn't get it anyones way.
Sleep doesn't really cut it, because you are then fixing yourself to only check a fixed number of times per second.
Block isn't it either, because you might want to do a few tasks before you check and &do_events.
So is there an easy solution? Is there a solution at all? Should I submit this for Perl 6 or has someone done so already?
____________________
Jeremy
I didn't believe in evil until I dated it.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.