Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: alarm() on windows 2003, overview

by syphilis (Archbishop)
on Feb 01, 2006 at 12:20 UTC ( [id://527040]=note: print w/replies, xml ) Need Help??


in reply to alarm() on windows 2003, overview

Just a minor nitpick - I think it's a little rash to assert that "it works fine (5.8.3 in Windows 2000) here".
The alarm() documentation states that "Each call disables the previous timer, and an argument of 0 may be supplied to cancel the previous timer without starting a new one. The returned value is the amount of time remaining on the previous timer".
I've never been able to get a return value of anything other than '0' on Windows 2000 - though I agree that, as a timeout mechanism, it can work fine. (Of course, if you're finding that alarm() is fully functional, then it's me that's being a "little rash" :-)

One other thought is that you might get better mileage from Win32::Process's Kill() method.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: alarm() on windows 2003, overview
by bonjedward (Novice) on Feb 08, 2006 at 14:27 UTC
    Thanks, I've started rewriting my programs with Win32::Process::Create(), and Wait(), and that's solved my problem. I have never examined the return values from alarm(), so it may not have been fully functional, but was quite useful nonetheless. The problem with Windows 2003 is that the timeout never occurs. I used it when calling processes that risk hanging. For example some proprietary so-called 'batch' routines that stupidly report errors with alert boxes. I started a countdown with alarm() based on expected time-to-complete, and if it timed out before the process returned, I'd kill the process to get rid of the alert box. If not, I'd cancel it with alarm(0); I also used it with Openwebload (from Sourceforge) which calls a GIS web site every few minutes and examines the result to see if a map was actually generated as a result of the call (if not, it restarts various processes). Unfortunately, if IIS is not running, Openwebload gets into an endless loop consuming 100% of CPU resources, and here alarm() was a useful safety valve allowing me to break out and kill it. So Win32::Process::Create(), and Wait() now do this, and it works fine. It will take me a while to rewrite all my scripts, though, so it is a pity that Windows 2003 has broken some useful (partially implemented) perl functions. thanks, David

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-26 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found