… | |
… | |
698 | |
698 | |
699 | =item $w = EV::signal $signal, $callback |
699 | =item $w = EV::signal $signal, $callback |
700 | |
700 | |
701 | =item $w = EV::signal_ns $signal, $callback |
701 | =item $w = EV::signal_ns $signal, $callback |
702 | |
702 | |
|
|
703 | =item $w = $loop->signal ($signal, $callback) |
|
|
704 | |
|
|
705 | =item $w = $loop->signal_ns ($signal, $callback) |
|
|
706 | |
703 | Call the callback when $signal is received (the signal can be specified by |
707 | Call the callback when $signal is received (the signal can be specified by |
704 | number or by name, just as with C<kill> or C<%SIG>). |
708 | number or by name, just as with C<kill> or C<%SIG>). |
|
|
709 | |
|
|
710 | Only one event loop can grab a given signal - attempting to grab the same |
|
|
711 | signal from two EV loops will crash the program immediately or cause data |
|
|
712 | corruption. |
705 | |
713 | |
706 | EV will grab the signal for the process (the kernel only allows one |
714 | EV will grab the signal for the process (the kernel only allows one |
707 | component to receive a signal at a time) when you start a signal watcher, |
715 | component to receive a signal at a time) when you start a signal watcher, |
708 | and removes it again when you stop it. Perl does the same when you |
716 | and removes it again when you stop it. Perl does the same when you |
709 | add/remove callbacks to C<%SIG>, so watch out. |
717 | add/remove callbacks to C<%SIG>, so watch out. |