Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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).


Comment on Re: How to sleep 1 microsecond?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987934]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-08-23 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (178 votes), past polls