… | |
… | |
202 | dSP; |
202 | dSP; |
203 | I32 mark = SP - PL_stack_base; |
203 | I32 mark = SP - PL_stack_base; |
204 | SV *sv_self, *sv_events; |
204 | SV *sv_self, *sv_events; |
205 | |
205 | |
206 | /* libev might have stopped the watcher */ |
206 | /* libev might have stopped the watcher */ |
207 | if (expect_false (w->e_flags & WFLAG_UNREFED) |
207 | if (ecb_expect_false (w->e_flags & WFLAG_UNREFED) |
208 | && !ev_is_active (w)) |
208 | && !ev_is_active (w)) |
209 | REF (w); |
209 | REF (w); |
210 | |
210 | |
211 | if (expect_true (sv_self_cache)) |
211 | if (ecb_expect_true (sv_self_cache)) |
212 | { |
212 | { |
213 | sv_self = sv_self_cache; sv_self_cache = 0; |
213 | sv_self = sv_self_cache; sv_self_cache = 0; |
214 | SvRV_set (sv_self, SvREFCNT_inc_NN (w->self)); |
214 | SvRV_set (sv_self, SvREFCNT_inc_NN (w->self)); |
215 | } |
215 | } |
216 | else |
216 | else |
217 | { |
217 | { |
218 | sv_self = newRV_inc (w->self); /* e_self (w) MUST be blessed by now */ |
218 | sv_self = newRV_inc (w->self); /* e_self (w) MUST be blessed by now */ |
219 | SvREADONLY_on (sv_self); |
219 | SvREADONLY_on (sv_self); |
220 | } |
220 | } |
221 | |
221 | |
222 | if (expect_true (sv_events_cache)) |
222 | if (ecb_expect_true (sv_events_cache)) |
223 | { |
223 | { |
224 | sv_events = sv_events_cache; sv_events_cache = 0; |
224 | sv_events = sv_events_cache; sv_events_cache = 0; |
225 | SvIV_set (sv_events, revents); |
225 | SvIV_set (sv_events, revents); |
226 | SvIOK_only (sv_events); |
226 | SvIOK_only (sv_events); |
227 | } |
227 | } |
… | |
… | |
237 | PUSHs (sv_events); |
237 | PUSHs (sv_events); |
238 | |
238 | |
239 | PUTBACK; |
239 | PUTBACK; |
240 | call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); |
240 | call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); |
241 | |
241 | |
242 | if (expect_false (SvREFCNT (sv_self) != 1 || sv_self_cache)) |
242 | if (ecb_expect_false (SvREFCNT (sv_self) != 1 || sv_self_cache)) |
243 | SvREFCNT_dec (sv_self); |
243 | SvREFCNT_dec (sv_self); |
244 | else |
244 | else |
245 | { |
245 | { |
246 | SvREFCNT_dec (SvRV (sv_self)); |
246 | SvREFCNT_dec (SvRV (sv_self)); |
247 | SvRV_set (sv_self, &PL_sv_undef); |
247 | SvRV_set (sv_self, &PL_sv_undef); |
248 | sv_self_cache = sv_self; |
248 | sv_self_cache = sv_self; |
249 | } |
249 | } |
250 | |
250 | |
251 | if (expect_false (SvREFCNT (sv_events) != 1 || sv_events_cache)) |
251 | if (ecb_expect_false (SvREFCNT (sv_events) != 1 || sv_events_cache)) |
252 | SvREFCNT_dec (sv_events); |
252 | SvREFCNT_dec (sv_events); |
253 | else |
253 | else |
254 | sv_events_cache = sv_events; |
254 | sv_events_cache = sv_events; |
255 | |
255 | |
256 | if (expect_false (SvTRUE (ERRSV))) |
256 | if (ecb_expect_false (SvTRUE (ERRSV))) |
257 | { |
257 | { |
258 | SPAGAIN; |
258 | SPAGAIN; |
259 | PUSHMARK (SP); |
259 | PUSHMARK (SP); |
260 | PUTBACK; |
260 | PUTBACK; |
261 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
261 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |