Permalink
Browse files

Make hookchain test use AnyEvent directly for its weird event loop se…

…tup.

Previously it depended on SetLoopTimeout but this facility doesn't work
in our new AnyEvent implementation, so we use an AnyEvent timer directly
to achieve the same result.
  • Loading branch information...
apparentlymart committed Jul 4, 2011
1 parent 86f4903 commit cefc75da57aa1b39fcd281c5a5396c7d75173078
Showing with 10 additions and 7 deletions.
  1. +10 −7 t/hookchain.t
View
@@ -132,13 +132,16 @@ is($track_obj, undef, "ref in executed fallback destroyed");
methods => {});
}
-Danga::Socket->SetLoopTimeout(1000);
+my $cv = AnyEvent->condvar;
my $left = 2;
-Danga::Socket->SetPostLoopCallback(sub {
- $left--;
- return 1 if $left > 0;
- return 0;
-});
-Danga::Socket->EventLoop();
+my $timer = AnyEvent->timer(
+ after => 0,
+ interval => 1,
+ cb => sub {
+ $left--;
+ $cv->send if $left <= 0;
+ },
+);
+$cv->recv;
1;

0 comments on commit cefc75d

Please sign in to comment.