develooper Front page | perl.perl5.porters | Postings from April 2010

Re: [perl.git] branch blead, updated. v5.12.0-57-g339aac2

Thread Next
Jerry D. Hedden
April 16, 2010 07:43
Re: [perl.git] branch blead, updated. v5.12.0-57-g339aac2
Message ID:
> commit f410a2119920dd04690025a349e79575cfb9c972
> Author: Nicholas Clark <>
> Date:   Thu Apr 15 11:37:53 2010 +0100
>    Move PERL_ASYNC_CHECK() from the runloop to control flow OPs.
>    For the typical code this gives a 5% speedup, and removes the cost of "safe
>    signals". Tight looping code will show less gains, but should never be slower.
>    Subtle bugs might remain - there might be constructions that enter the runloop
>    (where signals used to be dispatched) but don't contain any PERL_ASYNC_CHECK()
>    calls themselves.


Tests for my module Thread::Cancel started failing following this change.
The issue was my test threads used the following construct:

    my $thr = threads->create(sub { while (1) { } });

When I tried sending signals to the thread, it didn't pick them up.
My fix was to make the 'test loop' more realistic.

    sub test_loop
        my $x = 1;
        while ($x > 0) { threads->yield(); }

    my $thr = threads->create('test_loop');

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