… | |
… | |
39 | } |
39 | } |
40 | |
40 | |
41 | # I/O read |
41 | # I/O read |
42 | { |
42 | { |
43 | my $cv = AE::cv; |
43 | my $cv = AE::cv; |
44 | my $wt = AE::timer 0.1, 0, $cv; |
44 | my $wt = AE::timer 0.01, 0, $cv; |
45 | my $s = 0; |
45 | my $s = 0; |
46 | |
46 | |
47 | my $wa = AE::io $a, 0, sub { $cv->end; $s |= 1 }; |
47 | my $wa = AE::io $a, 0, sub { $cv->end; $s |= 1 }; |
48 | my $wb = AE::io $a, 0, sub { $cv->end; $s |= 2 }; |
48 | my $wb = AE::io $a, 0, sub { $cv->end; $s |= 2 }; |
49 | |
49 | |
… | |
… | |
64 | print $s == 3 ? "" : "not ", "ok 4 # $s\n"; |
64 | print $s == 3 ? "" : "not ", "ok 4 # $s\n"; |
65 | |
65 | |
66 | sysread $a, my $dummy, 1; |
66 | sysread $a, my $dummy, 1; |
67 | |
67 | |
68 | $cv = AE::cv; |
68 | $cv = AE::cv; |
69 | $wt = AE::timer 0.1, 0, $cv; |
69 | $wt = AE::timer 0.01, 0, $cv; |
70 | |
70 | |
71 | $s = 0; |
71 | $s = 0; |
72 | $cv->recv; |
72 | $cv->recv; |
73 | |
73 | |
74 | print $s == 0 ? "" : "not ", "ok 5 # $s\n"; |
74 | print $s == 0 ? "" : "not ", "ok 5 # $s\n"; |
75 | } |
75 | } |
76 | |
76 | |
77 | # signal |
77 | # signal |
78 | { |
78 | { |
79 | my $cv = AE::cv; |
79 | my $cv = AE::cv; |
80 | my $wt = AE::timer 0.1, 0, $cv; |
80 | my $wt = AE::timer 0.01, 0, $cv; |
81 | my $s = 0; |
81 | my $s = 0; |
82 | |
82 | |
83 | $cv->begin; my $wa = AE::signal INT => sub { $cv->end; $s |= 1 }; |
83 | $cv->begin; my $wa = AE::signal INT => sub { $cv->end; $s |= 1 }; |
84 | $cv->begin; my $wb = AE::signal INT => sub { $cv->end; $s |= 2 }; |
84 | $cv->begin; my $wb = AE::signal INT => sub { $cv->end; $s |= 2 }; |
85 | |
85 | |
… | |
… | |
88 | print $s == 0 ? "" : "not ", "ok 6 # $s\n"; |
88 | print $s == 0 ? "" : "not ", "ok 6 # $s\n"; |
89 | |
89 | |
90 | kill INT => $$; |
90 | kill INT => $$; |
91 | |
91 | |
92 | $cv = AE::cv; |
92 | $cv = AE::cv; |
93 | $wt = AE::timer 0.1, 0, $cv; |
93 | $wt = AE::timer 0.01, 0, $cv; |
94 | |
94 | |
95 | $s = 0; |
95 | $s = 0; |
96 | $cv->recv; |
96 | $cv->recv; |
97 | |
97 | |
98 | print $s == 3 ? "" : "not ", "ok 7 # $s\n"; |
98 | print $s == 3 ? "" : "not ", "ok 7 # $s\n"; |
99 | |
99 | |
100 | $cv = AE::cv; |
100 | $cv = AE::cv; |
101 | $wt = AE::timer 0.1, 0, $cv; |
101 | $wt = AE::timer 0.01, 0, $cv; |
102 | |
102 | |
103 | $s = 0; |
103 | $s = 0; |
104 | $cv->recv; |
104 | $cv->recv; |
105 | |
105 | |
106 | print $s == 0 ? "" : "not ", "ok 8 # $s\n"; |
106 | print $s == 0 ? "" : "not ", "ok 8 # $s\n"; |
… | |
… | |
109 | $AnyEvent::MAX_SIGNAL_LATENCY = 0.2; |
109 | $AnyEvent::MAX_SIGNAL_LATENCY = 0.2; |
110 | |
110 | |
111 | # child |
111 | # child |
112 | { |
112 | { |
113 | my $cv = AE::cv; |
113 | my $cv = AE::cv; |
114 | my $wt = AE::timer 0.1, 0, $cv; |
114 | my $wt = AE::timer 0.01, 0, $cv; |
115 | my $s = 0; |
115 | my $s = 0; |
116 | |
116 | |
117 | my $pid = fork; |
117 | my $pid = fork; |
118 | |
118 | |
119 | unless ($pid) { |
119 | unless ($pid) { |
… | |
… | |
131 | print $s == 0 ? "" : "not ", "ok 9 # $s\n"; |
131 | print $s == 0 ? "" : "not ", "ok 9 # $s\n"; |
132 | |
132 | |
133 | kill 9, $pid; |
133 | kill 9, $pid; |
134 | |
134 | |
135 | $cv = AE::cv; |
135 | $cv = AE::cv; |
136 | $wt = AE::timer 0.1, 0, $cv; |
136 | $wt = AE::timer 0.01, 0, $cv; |
137 | |
137 | |
138 | $s = 0; |
138 | $s = 0; |
139 | $cv->recv; |
139 | $cv->recv; |
140 | |
140 | |
141 | print $s == 3 ? "" : "not ", "ok 10 # $s\n"; |
141 | print $s == 3 ? "" : "not ", "ok 10 # $s\n"; |
142 | print $apid == $pid && $bpid == $pid ? "" : "not ", "ok 11 # $apid == $bpid == $pid\n"; |
142 | print $apid == $pid && $bpid == $pid ? "" : "not ", "ok 11 # $apid == $bpid == $pid\n"; |
143 | print $astatus == 9 && $bstatus == 9 ? "" : "not ", "ok 12 # $astatus == $bstatus == 9\n"; |
143 | print $astatus == 9 && $bstatus == 9 ? "" : "not ", "ok 12 # $astatus == $bstatus == 9\n"; |
144 | |
144 | |
145 | $cv = AE::cv; |
145 | $cv = AE::cv; |
146 | $wt = AE::timer 0.1, 0, $cv; |
146 | $wt = AE::timer 0.01, 0, $cv; |
147 | |
147 | |
148 | $s = 0; |
148 | $s = 0; |
149 | $cv->recv; |
149 | $cv->recv; |
150 | |
150 | |
151 | print $s == 0 ? "" : "not ", "ok 13 # $s\n"; |
151 | print $s == 0 ? "" : "not ", "ok 13 # $s\n"; |