GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PERL::UNSAFE::SIGNALS (3)

.ds Aq ’

NAME

Perl::Unsafe::Signals - Allow unsafe handling of signals in selected blocks

CONTENTS

SYNOPSIS



    use Perl::Unsafe::Signals;

    # ... some code ...
    local $SIG{ALRM} = sub { ... };
    alarm(60);
    UNSAFE_SIGNALS {
        # we want to interrupt this after one minute
        call_some_long_XS_function();
    };
    alarm(0);
    # ... continue ...



DESCRIPTION

Quoting perl581delta:

In Perl 5.8.0 the so-called safe signals were introduced. This means that Perl no longer handles signals immediately but instead between opcodes, when it is safe to do so. The earlier immediate handling easily could corrupt the internal state of Perl, resulting in mysterious crashes.

It’s possible since perl 5.8.1 to globally disable this feature by using the PERL_SIGNALS environment variables (as specified in PERL_SIGNALS in perlrun); but there’s no way to disable it locally, for a short period of time. That’s however something you might want to do, if, for example, your Perl program calls a C routine that will potentially run for a long time and for which you want to set a timeout.

This module therefore allows you to define UNSAFE_SIGNALS blocks in which signals will be handled unsafely.

Note that, no matter how short you make the unsafe block, it will still be unsafe. Use with caution.

NOTES

This module used to be a source filter, but is no longer, thanks to Scott McWhirter.

AUTHOR

Copyright (c) 2005, 2015 Rafael Garcia-Suarez. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

A git repository for the sources is at <https://github.com/rgs/Perl-Unsafe-Signals>.

SEE ALSO

perlrun, perl581delta
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SIGNALS (3) 2015-09-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.