ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.xs
(Generate patch)

Comparing EV/EV.xs (file contents):
Revision 1.13 by root, Mon Oct 29 18:33:02 2007 UTC vs.
Revision 1.14 by root, Tue Oct 30 12:48:29 2007 UTC

198static void 198static void
199e_cb (int fd, short events, void *arg) 199e_cb (int fd, short events, void *arg)
200{ 200{
201 struct ev *ev = (struct ev*)arg; 201 struct ev *ev = (struct ev*)arg;
202 dSP; 202 dSP;
203 203 I32 mark = SP - PL_stack_base;
204 ENTER; 204 SV *sv_self, *sv_events;
205 SAVETMPS; 205 static SV *sv_events_cache;
206 206
207 if (!(ev->ev.ev_events & EV_PERSIST) || (events & EV_TIMEOUT)) 207 if (!(ev->ev.ev_events & EV_PERSIST) || (events & EV_TIMEOUT))
208 ev->active = 0; 208 ev->active = 0;
209 209
210 sv_self = e_self (ev);
211
212 if (sv_events_cache)
213 {
214 sv_events = sv_events_cache; sv_events_cache = 0;
215 SvIV_set (sv_events, events);
216 }
217 else
218 sv_events = newSViv (events);
219
210 PUSHMARK (SP); 220 PUSHMARK (SP);
211 EXTEND (SP, 2); 221 EXTEND (SP, 2);
212 PUSHs (sv_2mortal (e_self (ev))); 222 PUSHs (sv_self);
213 PUSHs (sv_2mortal (newSViv (events))); 223 PUSHs (sv_events);
214 PUTBACK; 224 PUTBACK;
215 call_sv (ev->cb, G_DISCARD | G_VOID | G_EVAL); 225 call_sv (ev->cb, G_DISCARD | G_VOID | G_EVAL);
226 SP = PL_stack_base + mark; PUTBACK;
227
228 SvREFCNT_dec (sv_self);
229
230 if (sv_events_cache)
231 SvREFCNT_dec (sv_events);
232 else
233 sv_events_cache = sv_events;
216 234
217 if (ev->interval && !ev->active) 235 if (ev->interval && !ev->active)
218 e_start (ev); 236 e_start (ev);
219
220 FREETMPS;
221 237
222 if (SvTRUE (ERRSV)) 238 if (SvTRUE (ERRSV))
223 { 239 {
224 PUSHMARK (SP); 240 PUSHMARK (SP);
225 PUTBACK; 241 PUTBACK;
226 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); 242 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
243 SP = PL_stack_base + mark; PUTBACK;
227 } 244 }
228
229 LEAVE;
230} 245}
231 246
232///////////////////////////////////////////////////////////////////////////// 247/////////////////////////////////////////////////////////////////////////////
233// DNS 248// DNS
234 249

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines