ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/t/02_channel.t
(Generate patch)

Comparing Coro/t/02_channel.t (file contents):
Revision 1.2 by root, Fri Jul 13 13:05:38 2001 UTC vs.
Revision 1.5 by root, Mon Jul 23 02:14:20 2001 UTC

1$|=1; 1$|=1;
2print "1..19\n"; 2print "1..19\n";
3 3
4use Coro; 4use Coro;
5use Coro::Process;
6use Coro::Channel; 5use Coro::Channel;
7 6
8my $q = new Coro::Channel 0; 7my $q = new Coro::Channel 1;
9 8
10sub producer : Coro { 9sub producer : Coro {
11 for (1..9) { 10 for (1..9) {
12 print "ok ", $_*2, "\n"; 11 print "ok ", $_*2, "\n";
13 $q->put($_); 12 $q->put($_);
14 } 13 }
15} 14}
16 15
17print "ok 1\n"; 16print "ok 1\n";
18yield; 17cede;
19 18
20for (11..19) { 19for (11..19) {
21 my $x = do { local $_; $q->get }; 20 my $x = $q->get;
22 print $x == $_-10 ? "ok " : "not ok ", ($_-10)*2+1, "\n"; 21 print $x == $_-10 ? "ok " : "not ok ", ($_-10)*2+1, "\n";
23} 22}
24 23

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines