ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/02_signals.t
Revision: 1.9
Committed: Tue Aug 2 20:02:45 2011 UTC (12 years, 10 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-7_05, rel-7_07, rel-7_01, rel-7_02, rel-7_03, rel-7_08, rel-7_09, rel-7_16, rel-7_13, rel-7_11, rel-6_0, rel-6_1, rel-6_11, rel-6_12, rel-6_13, rel-7_15, rel-7_14, rel-7_12, rel-6_02, rel-6_01, rel-7_0, rel-7_04, rel-6_14, HEAD
Changes since 1.8: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

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