Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

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


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 16: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
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found