in reply to Coro, AnyEvent and performance
Instead of mucking around with Windows 3.0-esque pseudo-threading and polling, you could just use proper threading:
#! perl -slw use strict; use bignum; use threads; use threads::shared; my $result :shared; async { my $comp = 0; for my $i ( 1 .. 1e6 ) { $comp += $i ** $i; } $result = '' . $comp; }->detach; while( sleep 1 ) { print "timer event"; last if $result; } print $result;
It's simpler, and actually works!
|
|---|