NAME

POSIX::RT::Signal - POSIX Real-time signal handling functions

VERSION

version 0.018

SYNOPSIS

use POSIX::RT::Signal qw/sigqueue sigwaitinfo/;
use Signal::Mask;

$Signal::Mask{USR1}++;
sigqueue($$, 'USR1');
my $info = sigwaitinfo('USR1');

DESCRIPTION

This module exposes several advanced features and interfaces of POSIX real-time signals.

FUNCTIONS

sigqueue($pid, $sig, $value = 0)

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.

sigwaitinfo($signals)

Wait for a signal in $signals to arrive and return information on it as a Signal::Info object. 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. On error it returns an undef and $! should be consulted.

sigtimedwait($signals, $timeout)

This is like sigwaitinfo, except it has an additional timeout that indicates the maximal time the thread is suspended in fractional seconds; if no signal is received $! will be EAGAIN. Otherwise it behaves exactly the same as sigwaitinfo.

sigwait($signals)

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.

allocate_signal($priority)

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

deallocate_signal($signal)

Deallocate the signal to be reused for allocate_signal.

SEE ALSO

  • Signal::Mask

    An easy interface to signal masks

  • IPC::Signal

    Utility functions dealing with signals

  • POSIX::RT::Timer

    POSIX real-time timers. These will produce signals on timeout.

  • Linux::FD::Signal

    Linux signal file descriptors. This is an alternative interface to signals that allows for polling alongside

  • POSIX

    This core module contains various used in dealing with signals.

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

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.