ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/event.c
(Generate patch)

Comparing libev/event.c (file contents):
Revision 1.18 by root, Tue Nov 6 13:17:55 2007 UTC vs.
Revision 1.20 by root, Tue Nov 6 18:49:32 2007 UTC

142} 142}
143 143
144static void 144static void
145x_cb_sig (EV_P_ struct ev_signal *w, int revents) 145x_cb_sig (EV_P_ struct ev_signal *w, int revents)
146{ 146{
147 x_cb ((struct event *)(((char *)w) - offsetof (struct event, iosig.sig)), revents); 147 struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.sig));
148
149 if (revents & EV_ERROR)
150 event_del (ev);
151
152 x_cb (ev, revents);
148} 153}
149 154
150static void 155static void
151x_cb_io (EV_P_ struct ev_io *w, int revents) 156x_cb_io (EV_P_ struct ev_io *w, int revents)
152{ 157{
153 struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.io)); 158 struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.io));
154 159
160 if (revents & EV_ERROR)
161 event_del (ev);
155 if (!(ev->ev_events & EV_PERSIST) && ev_is_active (w)) 162 else if (!(ev->ev_events & EV_PERSIST) && ev_is_active (w))
156 ev_io_stop (EV_A_ w); 163 ev_io_stop (EV_A_ w);
157 164
158 x_cb (ev, revents); 165 x_cb (ev, revents);
159} 166}
160 167
330}; 337};
331 338
332static void 339static void
333x_once_cb (int revents, void *arg) 340x_once_cb (int revents, void *arg)
334{ 341{
335 struct x_once *once = arg; 342 struct x_once *once = (struct x_once *)arg;
336 343
337 once->cb (once->fd, revents, once->arg); 344 once->cb (once->fd, revents, once->arg);
338 free (once); 345 free (once);
339} 346}
340 347
341int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv) 348int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv)
342{ 349{
343 struct x_once *once = malloc (sizeof (struct x_once)); 350 struct x_once *once = (struct x_once *)malloc (sizeof (struct x_once));
344 dLOOPbase; 351 dLOOPbase;
345 352
346 if (!once) 353 if (!once)
347 return -1; 354 return -1;
348 355

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines