ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/t/07_feeder.t
Revision: 1.1
Committed: Sun Oct 22 13:33:28 2006 UTC (17 years, 8 months ago) by root
Content type: application/x-troff
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/usr/bin/perl
2    
3     use IO::AIO;
4    
5     print "1..6\n";
6    
7     my $grp = aio_group sub {
8     print "ok 4\n";#d#
9     };
10    
11     my $cn1 = 10;
12     my $cn2 = 0;
13     my $cn3 = 0;
14    
15     print "ok 1\n";
16    
17     $grp->feeder_limit (5);
18     $grp->set_feeder (sub {
19     return if $cn2 >= 10;
20     $cn2++;
21     add $grp IO::AIO::aio_sleep 0, sub {
22     $cn3++;
23     };
24     });
25    
26     print $cn2 == 5 ? "" : "not ", "ok 2\n";
27     print $cn3 == 0 ? "" : "not ", "ok 3\n";
28    
29     IO::AIO::poll while IO::AIO::nreqs;
30    
31     print $cn2 == 10 ? "" : "not ", "ok 5\n";
32     print $cn3 == 10 ? "" : "not ", "ok 6\n";
33