ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/AnyEvent-Fork-RPC/t/04_flush.t
Revision: 1.1
Committed: Sun Sep 15 20:18:14 2019 UTC (7 years ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
2.0

File Contents

# Content
1 $| = 1;
2 print "1..10\n";
3
4 use AnyEvent::Fork;
5 use AnyEvent::Fork::RPC;
6
7 sub ok($;$) {
8 print $_[0] ? "" : "not ", "ok ", ++$::ok, " # $_[1]\n";
9 }
10
11 ok 1;
12
13 my $code = do { local $/; <DATA> };
14
15 for my $async (0, 1) {
16 my ($cv, $ev);
17
18 my $rpc = AnyEvent::Fork
19 ->new
20 ->eval ($code)
21 ->AnyEvent::Fork::RPC::run ("run",
22 async => $async,
23 on_error => sub { ok $ev, "on_error"; $cv->send },
24 on_event => sub { ok $_[0], "event"; $ev = 1 },
25 on_destroy => $done,
26 );
27
28 ok 1, "before";
29 $rpc->(0, $cv = AE::cv);
30 $cv->recv;
31 ok 1, "after";
32 }
33
34 ok 1;
35
36 __DATA__
37
38 sub run {
39 AnyEvent::Fork::RPC::event (1);
40 AnyEvent::Fork::RPC::flush ();
41 exit 2;
42 }