develooper Front page | perl.perl5.porters | Postings from March 2008

faster safe signals?

Nicholas Clark
March 21, 2008 05:22
faster safe signals?
Message ID:
chromatic generated this RT ticket for parrot:

On Tue, Mar 18, 2008 at 05:13:25PM -0700, Chromatic wrote:
> # New Ticket Created by  chromatic 
> # Please include the string:  [perl #51870]
> # in the subject line of all future correspondence about this issue. 
> # <URL: >
> Currently, the concurrency and events system only handles pending events at 
> specific points, depending on runcore and opcodes.  (For example, when you 
> use the sleep opcode, when you enter a new predereferenced section, or when 
> you schedule a new event.)
> We need to figure out exactly when, how, and how often to run our event loop 
> more frequently.

It made me wonder. Currently the perl 5 runloop looks like this:

    while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX))) {

    return 0;


# 3 "PERL_ASYNC_CHECK expands to"
if ((my_perl->Isig_pending)) Perl_despatch_signals(my_perl)

We do the check after every op. I wondered, if we did the check

1: At every LOGOP (so every loop iteration)
2: At scope exit
3: At scope entry (or just subroutine entry, given 1 and 2)
4: Before sleep and select
5: Before and after IO operations
6: (maybe also) every time the regexp engine backtracks

would Perl 5 be just as responsive at handling signals as it is currently, but
also faster in the general case?

Nicholas Clark Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About