File: 06_group.t

package info (click to toggle)
libio-aio-perl 2.4-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 356 kB
  • ctags: 76
  • sloc: perl: 413; ansic: 97; makefile: 50
file content (64 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/perl

use IO::AIO;

print "1..12\n";

IO::AIO::min_parallel 2;#d#

my $grp = aio_group sub {
   print $_[0] == 1 && @_ == 3 ? "" : "not ", "ok 4\n";
};

$grp->result (1,2,3);

my ($a, $b) =
   add $grp (aio_stat "/2", sub { print "ok 3\n" }),
            (aio_stat "/3", sub { print "not ok 3\n" });

print "ok 1\n";

$b->cancel;

print "ok 2\n";

IO::AIO::poll while IO::AIO::nreqs;

print "ok 5\n";

$grp = aio_group sub {
   print @_ == 0 ? "" : "not ", "ok 6\n";
};

$grp->result (4,5,6);
$grp->result;

add $grp aio_stat "/1", sub { print "not ok 7\n" };

$grp->cancel;

print "ok 6\n";

IO::AIO::poll while IO::AIO::nreqs;

aio_group sub {
   print "ok 8\n";
};

print "ok 7\n";

IO::AIO::poll while IO::AIO::nreqs;

IO::AIO::aio_busy 0, sub { print "ok 9\n" };

IO::AIO::poll while IO::AIO::nreqs;

print "ok 10\n";

aio_nop sub {
   print "ok 11\n";
};

IO::AIO::poll while IO::AIO::nreqs;

print "ok 12\n";