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

Comparing AnyEvent/t/02_signals.t (file contents):
Revision 1.1 by root, Sun Dec 10 23:59:15 2006 UTC vs.
Revision 1.9 by root, Tue Aug 2 20:02:45 2011 UTC

1$|=1; 1BEGIN {
2BEGIN { print "1..5\n" } 2 unless (exists $SIG{USR1}) {
3 print <<EOF;
41..0 # SKIP Broken perl detected, skipping tests.
5EOF
6 exit 0;
7 }
8}
3 9
4use AnyEvent; 10use AnyEvent;
11BEGIN { require AnyEvent::Impl::Perl unless $ENV{PERL_ANYEVENT_MODEL} }
12
13$| = 1; print "1..5\n";
5 14
6print "ok 1\n"; 15print "ok 1\n";
7 16
8my $cv = AnyEvent->condvar; 17my $cv = AnyEvent->condvar;
9 18
19my $error = AnyEvent->timer (after => 5, cb => sub {
20 print <<EOF;
21Bail out! No signal caught.
22EOF
23 exit 0;
24});
25
10my $sw = AnyEvent->signal (signal => 'CHLD', cb => sub { 26my $sw = AnyEvent->signal (signal => 'INT', cb => sub {
11 print "ok 3\n"; 27 print "ok 3\n";
12 $cv->broadcast; 28 $cv->broadcast;
13}); 29});
14 30
15print "ok 2\n"; 31print "ok 2\n";
16kill 'CHLD', 0; 32kill 'INT', $$;
17$cv->wait; 33$cv->recv;
34undef $error;
35
36print "ok 4\n";
18 37
19undef $sw; 38undef $sw;
20 39
21print "ok 4\n"; 40print "ok 5\n";
22 41
23kill 'CHLD', 0;
24
25print "ok 5\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines