ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/02_signals.t
Revision: 1.6
Committed: Sat Jul 18 00:05:29 2009 UTC (14 years, 11 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-4_86, rel-0_85
Changes since 1.5: +2 -5 lines
Log Message:
*** empty log message ***

File Contents

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