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

Comparing libev/event.c (file contents):
Revision 1.22 by root, Thu Nov 8 21:20:51 2007 UTC vs.
Revision 1.25 by root, Fri Nov 9 21:48:23 2007 UTC

35 35
36#ifndef WIN32 36#ifndef WIN32
37# include <sys/time.h> 37# include <sys/time.h>
38#endif 38#endif
39 39
40#include "ev.h" 40#ifdef EV_EVENT_H
41# include EV_EVENT_H
42#else
41#include "event.h" 43# include "event.h"
44#endif
42 45
43#if EV_MULTIPLICITY 46#if EV_MULTIPLICITY
44# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base 47# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base
45# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base 48# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base
46#else 49#else
176} 179}
177 180
178void event_set (struct event *ev, int fd, short events, void (*cb)(int, short, void *), void *arg) 181void event_set (struct event *ev, int fd, short events, void (*cb)(int, short, void *), void *arg)
179{ 182{
180 if (events & EV_SIGNAL) 183 if (events & EV_SIGNAL)
181 ev_watcher_init (&ev->iosig.sig, x_cb_sig); 184 ev_init (&ev->iosig.sig, x_cb_sig);
182 else 185 else
183 ev_watcher_init (&ev->iosig.io, x_cb_io); 186 ev_init (&ev->iosig.io, x_cb_io);
184 187
185 ev_watcher_init (&ev->to, x_cb_to); 188 ev_init (&ev->to, x_cb_to);
186 189
187 ev->ev_base = x_cur; /* not threadsafe, but its like libevent works */ 190 ev->ev_base = x_cur; /* not threadsafe, but its like libevent works */
188 ev->ev_fd = fd; 191 ev->ev_fd = fd;
189 ev->ev_events = events; 192 ev->ev_events = events;
190 ev->ev_pri = 0; 193 ev->ev_pri = 0;
248 return 0; 251 return 0;
249} 252}
250 253
251void event_active (struct event *ev, int res, short ncalls) 254void event_active (struct event *ev, int res, short ncalls)
252{ 255{
256 dLOOPev;
257
253 if (res & EV_TIMEOUT) 258 if (res & EV_TIMEOUT)
254 ev_feed_event (&ev->to, res & EV_TIMEOUT); 259 ev_feed_event (EV_A_ &ev->to, res & EV_TIMEOUT);
255 260
256 if (res & EV_SIGNAL) 261 if (res & EV_SIGNAL)
257 ev_feed_event (&ev->iosig.sig, res & EV_SIGNAL); 262 ev_feed_event (EV_A_ &ev->iosig.sig, res & EV_SIGNAL);
258 263
259 if (res & (EV_READ | EV_WRITE)) 264 if (res & (EV_READ | EV_WRITE))
260 ev_feed_event (&ev->iosig.io, res & (EV_READ | EV_WRITE)); 265 ev_feed_event (EV_A_ &ev->iosig.io, res & (EV_READ | EV_WRITE));
261} 266}
262 267
263int event_pending (struct event *ev, short events, struct timeval *tv) 268int event_pending (struct event *ev, short events, struct timeval *tv)
264{ 269{
265 short revents = 0; 270 short revents = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines