1 |
root |
1.1 |
$|=1; |
2 |
root |
1.4 |
BEGIN { |
3 |
|
|
print "1..5\n"; |
4 |
|
|
} |
5 |
root |
1.1 |
|
6 |
|
|
use AnyEvent; |
7 |
root |
1.3 |
use AnyEvent::Impl::Perl; |
8 |
root |
1.1 |
|
9 |
root |
1.4 |
print STDERR <<EOF; |
10 |
|
|
|
11 |
|
|
If the following test hangs for a long time or terminates with a signal |
12 |
|
|
you either found a bug in AnyEvent or, more likely, you have a defective |
13 |
|
|
perl (most windows perl distros are broken, cygwin perl works). If you do |
14 |
|
|
not rely on signal handlers you can force the installation of this module |
15 |
|
|
and the rest will likely work. Otherwise upgrading to a working perl is |
16 |
|
|
recommended. |
17 |
|
|
EOF |
18 |
|
|
|
19 |
root |
1.1 |
print "ok 1\n"; |
20 |
|
|
|
21 |
|
|
my $cv = AnyEvent->condvar; |
22 |
|
|
|
23 |
root |
1.4 |
my $error = AnyEvent->timer (after => 5, cb => sub { |
24 |
|
|
print <<EOF; |
25 |
|
|
Bail out! No signal caught. |
26 |
|
|
EOF |
27 |
|
|
exit 0; |
28 |
|
|
}); |
29 |
|
|
|
30 |
|
|
my $sw = AnyEvent->signal (signal => 'INT', cb => sub { |
31 |
root |
1.1 |
print "ok 3\n"; |
32 |
|
|
$cv->broadcast; |
33 |
|
|
}); |
34 |
|
|
|
35 |
|
|
print "ok 2\n"; |
36 |
root |
1.4 |
kill 'INT', $$; |
37 |
root |
1.1 |
$cv->wait; |
38 |
root |
1.4 |
undef $error; |
39 |
root |
1.1 |
|
40 |
root |
1.2 |
print "ok 4\n"; |
41 |
|
|
|
42 |
root |
1.1 |
undef $sw; |
43 |
|
|
|
44 |
root |
1.2 |
print "ok 5\n"; |
45 |
root |
1.1 |
|