ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/13_weaken.t
Revision: 1.1
Committed: Tue Sep 17 23:40:53 2019 UTC (4 years, 8 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: HEAD
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 use Scalar::Util qw(weaken);
2     use AnyEvent;
3     BEGIN { require AnyEvent::Impl::Perl unless $ENV{PERL_ANYEVENT_MODEL} }
4    
5     $| = 1; print "1..7\n";
6    
7     print "ok 1\n";
8    
9     my $c1 = AnyEvent->condvar;
10     my $c2 = AE::cv;
11    
12     my $t1 = AnyEvent->timer (after => 0.1, cb => sub { print "ok 3\n"; $c1->() });
13     my $t2 = AnyEvent->timer (after => 0.5, cb => sub { print "not ok 6\n" });
14     my $t3 = AnyEvent->timer (after => 0.9, cb => sub { print "ok 6\n"; $c2->send });
15    
16     print "ok 2\n";
17    
18     $c1->wait;
19    
20     print "ok 4\n";
21    
22     Scalar::Util::weaken $t2;
23    
24     print $t2 ? "not " : "", "ok 5\n";
25    
26     $c2->wait;
27    
28     print "ok 7\n";