Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: $SIG{ALRM} and windows vista?

by ikegami (Pope)
on Jan 04, 2010 at 06:37 UTC ( #815524=note: print w/ replies, xml ) Need Help??


in reply to Re: $SIG{ALRM} and windows vista?
in thread $SIG{ALRM} and windows vista?

Not true.

$ perl 815492.pl Enter your password: You timed out.

Signals for which there is a handler will interrupt I/O operations (at the OS level) even under safe signals. readline returns (with errno = EINTR) as soon as the signal is received, allowing the signal handler to be called within milliseconds even under safe signals.


Comment on Re^2: $SIG{ALRM} and windows vista?
Select or Download Code
Re^3: $SIG{ALRM} and windows vista?
by BrowserUk (Pope) on Jan 04, 2010 at 06:56 UTC

    Not on my Vista system.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      It sounds like you're saying that signals don't interrupt I/O on Windows, but you know that only thing that Windows has that is similar to signals are Ctrl-C and Ctrl-Break. Are you saying they don't interrupt I/O? I haven't tested how they work.

      Update: Clarified.

        Windows doesn't have signals

        No, but it simulates some of them:

        use strict; use warnings; use 5.010; print 'Enter your password: '; my $password = eval { local $SIG{ALRM} = sub {die "timeout\n"}; alarm 5; # return <STDIN>; sleep 10; }; alarm 0; if ($@ =~ /timeout/) { print "You timed out.\n"; } __END__ [ 7:18:01.22] C:\test>alarmit.pl Enter your password: You timed out.

        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2014-07-10 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls