Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: making something happen in real time

by bageler (Hermit)
on Nov 06, 2005 at 20:55 UTC ( [id://506151]=note: print w/replies, xml ) Need Help??


in reply to making something happen in real time

you could select more frequently and have it check for $t intervals to play the tone, that way your script would be the cpu hog and demand more attention from the system.

Replies are listed 'Best First'.
Re^2: making something happen in real time
by bcrowell2 (Friar) on Nov 06, 2005 at 21:58 UTC
    Well, I could just spin in a tight loop instead of using select, but I'd like to avoid having my program be a cpu hog when it shouldn't have any need to be. I don't think sleeping for shorter intervals will help, because it just seems to require several hundred milliseconds to get the cpu back from xscreensaver, and that's a lot longer than the timing resolution I need.
      Well, it sounds like that's what you should do to me. If there's a swinging blade (xscreensaver) and you want to dodge between it (beep) you have to have better time resolution than the period of the pendulum. Maybe you could increase the resolution only near the time when the screensaver should be kicking in? Then, for the majority of the time, you can be less of a cpu hog. That would still leave you vulnerable to anything else that might be going on in your system that also has a high resolution.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-03-28 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found