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

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

Thread Next
From:
Jerry D. Hedden
Date:
April 16, 2010 07:43
Subject:
Re: [perl.git] branch blead, updated. v5.12.0-57-g339aac2
Message ID:
r2l1ff86f511004160645l77480015i5c2c4c3021888ee1@mail.gmail.com
> commit f410a2119920dd04690025a349e79575cfb9c972
> Author: Nicholas Clark <nick@ccl4.org>
> 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.

FYI,

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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About