ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/69_ev_02_signals.t
Revision: 1.1
Committed: Thu Oct 2 08:43:58 2008 UTC (15 years, 9 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-4_35, rel-4_4, rel-4_45, rel-4_41, rel-4_352, rel-4_42, rel-4_31, rel-4_32, rel-4_34, rel-4_412, rel-4_81, rel-4_3, rel-4_33, rel-4_411, rel-4_351, rel-4_8, rel-4_331
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 $|=1;
2     BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } }
3     BEGIN {
4     print "1..5\n";
5     }
6    
7     use AnyEvent;
8     use AnyEvent::Impl::EV;
9    
10     print "ok 1\n";
11    
12     my $cv = AnyEvent->condvar;
13    
14     my $error = AnyEvent->timer (after => 5, cb => sub {
15     print <<EOF;
16     Bail out! No signal caught.
17     EOF
18     exit 0;
19     });
20    
21     my $sw = AnyEvent->signal (signal => 'INT', cb => sub {
22     print "ok 3\n";
23     $cv->broadcast;
24     });
25    
26     print "ok 2\n";
27     kill 'INT', $$;
28     $cv->wait;
29     undef $error;
30    
31     print "ok 4\n";
32    
33     undef $sw;
34    
35     print "ok 5\n";
36