Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: How to sleep 1 microsecond?

by moritz (Cardinal)
on Aug 17, 2012 at 08:12 UTC ( #987934=note: print w/replies, xml ) Need Help??

in reply to How to sleep 1 microsecond?

If you are on a modern operating system, you cannot do that reliably. Any kind of sleep call is likely to trigger a task switch where the OS puts your process in the background executes another one. And even if you don't sleep, that can still happen.

If you absolutely need such exact timings (what for?) consider using a real-time operating system, and probably not Perl either (Perl does some stuff under the hood that can be harmful when you need exact timings. Examples are re-hashing of hash tables, and freeing variables on scope exit).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987934]
choroba was busy with the Pull Request Challenge

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-01-23 09:53 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (192 votes). Check out past polls.