Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
There's more than one way to do things
 
PerlMonks  

Re: win32, ctrl-c, sleep, and signals

by cdarke (Prior)
on May 30, 2006 at 13:11 UTC ( [id://552554]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to win32, ctrl-c, sleep, and signals

See ActiveState's ActivePerl FAQ - Implementation Quirks documentation, "Why doesn't signal handling work on Windows?". Signals are a UNIX thing, and are only implemented in the C runtime library on Windows enough to conform to C89 standards. For example, on Linux sleep will raise a SIGALRM when it times out, but on Windows SIGALRM is not supported (alarm is one of the functions listed as not implemented by ActiveState).
Windows uses a different architecture for console handling compared to UNIX terminal handling. In Win32 a CTRL+C (or Break) is controlled using SetConsoleCtrlHandler, not signals in the UNIX sense (even though the MSDN talks about raising a signal).

Replies are listed 'Best First'.
Re^2: win32, ctrl-c, sleep, and signals
by Anonymous Monk on Jun 01, 2006 at 12:45 UTC
    alarm() is implemented in perl5.8+ on win32. just try it:
    perl -e "eval {local $SIG{ALRM} = sub { die qq!alarm\n! };alarm 1;slee +p 2;alarm 0;};die $@ || 'nothing'"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://552554]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.