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