output:use strict; use warnings; use Coro; use Coro::EV; use Coro::LWP; use LWP::Simple; use Coro::Timer qw(sleep); async { while (1) { CORE::select undef, undef, undef, 0.5; print "first\n"; # my $r = get "http://www.perlmonks.org"; # print length $r, "\n"; # sleep 0; cede; } }; async { while (1) { CORE::select undef, undef, undef, 0.5; print "second\n"; # sleep 0; cede; } }; EV::loop while 1;
When uncommentfirst second first second first second ...
got output:my $r = get "http://www.perlmonks.org"; print length $r, "\n";
Then uncomment "sleep 0" and got output :first second second second second second second second
first second 76573 second first second 76570 second first second 76597 second first second
In reply to Re^2: Coro, EV and cede
by Nick Kostirya
in thread Coro, EV and cede
by Nick Kostirya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |