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

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

Thread Previous
From:
Jerry D. Hedden
Date:
April 19, 2010 06:23
Subject:
Re: [perl.git] branch blead, updated. v5.12.0-57-g339aac2
Message ID:
s2y1ff86f511004190622q52a242e8jdb5c560925d072bd@mail.gmail.com
On Sun, Apr 18, 2010 at 13:53, Nicholas Clark <nick@ccl4.org> wrote:
> On Fri, Apr 16, 2010 at 09:45:33AM -0400, Jerry D. Hedden wrote:
>> > 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.
>
> Thanks for spotting this.
>
>> 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');
>
> Does 8165faea6ee20f11c287f0f531d49cc63ea9e6f3 make the original code work
> again?

Yes, it does.  Thanks.

Thread Previous


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