in reply to Re: Coro, EV and cede
in thread Coro, EV and cede
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Coro, EV and cede
by Corion (Patriarch) on Apr 07, 2011 at 12:12 UTC | |
by Nick Kostirya (Sexton) on Apr 07, 2011 at 12:36 UTC | |
|
Re^3: Coro, EV and cede
by zwon (Abbot) on Apr 07, 2011 at 13:00 UTC | |
by Nick Kostirya (Sexton) on Apr 07, 2011 at 13:22 UTC | |
by zwon (Abbot) on Apr 07, 2011 at 14:20 UTC |