[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 19991229.003] perl 5.005_03 core dumps -- singal



On Mon, Jan 10, 2000 at 03:54:56PM -0800, Larry Wall wrote:
> Ilya Zakharevich writes:
> : > This has all been discussed before.  We need to delay sub invocations
> : > until we know we're in a safe state, such as the beginning of a
> : > statement, or at the interator of any looping constructs, including
> : > regular expressions.
> : 
> : No, we do not *need* to delay sub invocations.  Delaying the
> : invocation is one of the possible workarounds to the current
> : disaster.  It has many negative effects, like being a NOP in the case
> : of a long-running opcode.
> 
> And in what way does your proposal help this?  What interrupts the
> long running opcode in your version of reality?

The kernel, of course.

> You modified some existing variables, so what?

Modification of existing variables is the smallest problem of Perl
signal handlers.  All the real damage is done during the subroutine
call frame.  And using the proposed interface you do not need the
subroutine call.  Moreover, you may insure that the changes you do
from the signal handler are atomic (say, by croaking if an atomic
change is not possible).

> : And you can do
> : 
> : $SIG{CHLD} = [delayed => sub {...}, repeated => [2, sub {...}] ];
> : 
> : which might mean that if another signal appears when one is delayed
> : (meaning: AHA, something dangerous happens: signal was not served,
> : probably a long-running opcode, we need some recovery action), another
> : sub (or maybe another %SIG-compatible specification, as at the start)
> : should be run.
> 
> That's more needless complexity.  This should be hidden from the user.
> Immediate dispatch on duplicate signals could be done in the current
> scheme as well without exposing it to the poor user. 

Yes, it may be done.  However, it is done *dangerously*, why in my
scheme it may be done safely.

And if you do not like the interface, write a module which
deparses

 sub { ++$count; return }

to [ inc => \$count ].  Make assignment to $SIG autoload this module.
If deparse fails, enable the delayed samantic.

Ilya


Follow-Ups from:
Tom Christiansen <tchrist@jhereg.perl.com>
References to:
Ilya Zakharevich <ilya@math.ohio-state.edu>
Larry Wall <larry@wall.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]