POSIX::RT::Signal - POSIX Real-time signal handling functions
version 0.015
use POSIX::RT::Signal qw/sigqueue sigwaitinfo/; use Signal::Mask; $Signal::Mask{USR1}++; sigqueue($$, 'USR1'); my $info = sigwaitinfo('USR1');
This module exposes several advanced features and interfaces of POSIX real-time signals.
Queue a signal $sig to process $pid, optionally with the additional argument $value. On error an exception is thrown. $sig must be either a signal number(14) or a signal name ('ALRM'). If the signal queue is full, it returns undef and sets $! to EAGAIN.
$pid
$value
$sig
14
'ALRM'
$!
Wait for a signal in $signals to arrive and return information on it. The signal handler (if any) will not be called. Unlike signal handlers it is not affected by signal masks, in fact you are expected to mask signals you're waiting for. $signals must either be a POSIX::SigSet object, a signal number or a signal name. If $timeout is specified, it indicates the maximal time the thread is suspended in fractional seconds; if no signal is received it returns an empty list, or in void context an exception. If $timeout is not defined it may wait indefinitely until a signal arrives. On success it returns a hash with the following entries:
$signals
$timeout
signo
The signal number
code
The signal code, a signal-specific code that gives the reason why the signal was generated
errno
If non-zero, an errno value associated with this signal
pid
Sending process ID
uid
Real user ID of sending process
addr
The address of faulting instruction
status
Exit value or signal
band
Band event for SIGPOLL
value
Signal integer value as passed to sigqueue
ptr
The pointer integer as passed to sigqueue
Note that not all of these will have meaningful values for all or even most signals
This is an alias for sigwaitinfo.
Wait for a signal in $signals to arrive and return it. The signal handler (if any) will not be called. Unlike signal handlers it is not affected by signal masks, in fact you are expected to mask signals you're waiting for. $signals must either be a POSIX::SigSet object, a signal number or a signal name.
Pick a signal from the set of signals available to the user. The signal will not be given to any other caller of this function until it has been deallocated. If supported, these will be real-time signals. By default it will choose the lowest priority signal available, but if $priority is true it will pick the highest priority one. If real-time signals are not supported this will return SIGUSR1 and SIGUSR2
$priority
SIGUSR1
SIGUSR2
Deallocate the signal to be reused for allocate_signal.
allocate_signal
Signal::Mask
IPC::Signal
POSIX::RT::Timer
POSIX
Linux::FD::Signal
Leon Timmermans <fawaka@gmail.com>
This software is copyright (c) 2011 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install POSIX::RT::Signal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POSIX::RT::Signal
CPAN shell
perl -MCPAN -e shell install POSIX::RT::Signal
For more information on module installation, please visit the detailed CPAN module installation guide.