Perl

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Thread signalling

    2 answers - 131 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    This patch adds a ->kill() object method to the 'threads' package to
    support sending signals to threads.
  • No.1 | | 2049 bytes | |

    A few comments on your patch :

    Jerry D. Hedden wrote:
    diff -urN
    2006-04-28 08:11:04.000000000 -0400
    2006-05-10 14:05:42.000000000 -0400
    @@ -16,10 +50,21 @@
    'NRECURS' =1);
    } else {
    # CPAN
    - push(@conditional_params, 'DEFINE' ='-DHAS_PPPRT_H');
    +
    + # Verify that a 'C' compiler is available
    + require File::Spec;
    + require Config;
    + import Config;

    This require/import seems to be unnecessary, since Config is loaded in
    have_cc().

    diff -urN
    2006-05-09 04:04:58.000000000 -0400
    2006-05-10 14:23:42.000000000 -0400
    @@ -146,6 +146,8 @@
    $stack_size = threads->get_stack_size();
    $old_size = threads->set_stack_size(32*4096);

    + $thr->kill('SIGUSR1');
    +
    =head1 DESCRIPTIN

    Perl 5.6 introduced something called interpreter threads. Interpreter threads
    @@ -405,6 +407,88 @@

    =back

    +=head1 THREAD SIGNALLING
    +
    +If Perl has been compiled to use safe signals (i.e., was not built with
    +C<PERLLD_SIGNALS- see C<perl -V>), then signals may be sent and acted upon
    +by individual threads.

    I think you shouldn't mention PERLLD_SIGNALS at all in threads.pm's
    doc, it doesn't exist anymore in bleadperl or maintperl. However maybe
    you can mention than using unsafe signals (see perlrun) breaks code that
    uses thread signalling.

    +=over 4
    +
    +=item $thr->kill('SIG');

    Some suggestions that may or may not make sense :

    Potential cause of error : SIGF isn't a valid %SIG key (one writes
    %SIG{USR1} for example), and it often gets me, so maybe you should allow
    F as well as SIGF here ?

    Also, the error message could be "No such signal: SIG%s" like in
    perldiag. (documented later in your pod)

    Should we croak or warn when an unknown signal name is used ? Assigning
    to $SIG{F} only warns. Maybe this should do likewise, for consistency.
    Not all signals exist everywhere.
  • No.2 | | 499 bytes | |

    Wed, May 10, 2006 at 12:07:02PM -0700, Jerry D. Hedden wrote:
    This patch adds a ->kill() object method to the 'threads' package to
    support sending signals to threads.

    think the documentation should make clear that this isn't sending a signal
    to a thread, its *emulating* sending a signal; ie the perl-level stuff
    happens - like calling the sig handler function, but no S-level effects
    eg $thd->kill(STP) won't necessariy suspend the thread or process

Re: Thread signalling


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "Perl"

EMSDN.COM