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

Comparing libev/ev.c (file contents):
Revision 1.4 by root, Tue Oct 30 23:10:33 2007 UTC vs.
Revision 1.5 by root, Tue Oct 30 23:54:38 2007 UTC

12# define HAVE_MONOTONIC 1 12# define HAVE_MONOTONIC 1
13#endif 13#endif
14 14
15#define HAVE_EPOLL 1 15#define HAVE_EPOLL 1
16#define HAVE_REALTIME 1 16#define HAVE_REALTIME 1
17#define HAVE_SELECT 0 17#define HAVE_SELECT 1
18 18
19#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */ 19#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
20#define MAX_BLOCKTIME 60. 20#define MAX_BLOCKTIME 60.
21 21
22#include "ev.h" 22#include "ev.h"
34int ev_method; 34int ev_method;
35 35
36static int have_monotonic; /* runtime */ 36static int have_monotonic; /* runtime */
37 37
38static ev_tstamp method_fudge; /* stupid epoll-returns-early bug */ 38static ev_tstamp method_fudge; /* stupid epoll-returns-early bug */
39static void (*method_reify)(void); 39static void (*method_modify)(int fd, int oev, int nev);
40static void (*method_poll)(ev_tstamp timeout); 40static void (*method_poll)(ev_tstamp timeout);
41 41
42ev_tstamp 42ev_tstamp
43ev_time (void) 43ev_time (void)
44{ 44{
234} 234}
235 235
236void ev_postfork_child (void) 236void ev_postfork_child (void)
237{ 237{
238#if HAVE_EPOLL 238#if HAVE_EPOLL
239 if (ev_method == EVMETHOD_EPOLL)
239 epoll_postfork_child (); 240 epoll_postfork_child ();
240#endif 241#endif
242}
243
244static void
245fd_reify (void)
246{
247 int i;
248
249 for (i = 0; i < fdchangecnt; ++i)
250 {
251 int fd = fdchanges [i];
252 ANFD *anfd = anfds + fd;
253 struct ev_io *w;
254
255 int wev = 0;
256
257 for (w = anfd->head; w; w = w->next)
258 wev |= w->events;
259
260 if (anfd->wev != wev)
261 {
262 method_modify (fd, anfd->wev, wev);
263 anfd->wev = wev;
264 }
265 }
266
267 fdchangecnt = 0;
241} 268}
242 269
243static void 270static void
244call_pending () 271call_pending ()
245{ 272{
336 ev_loop_done = flags & EVLOOP_ONESHOT; 363 ev_loop_done = flags & EVLOOP_ONESHOT;
337 364
338 do 365 do
339 { 366 {
340 /* update fd-related kernel structures */ 367 /* update fd-related kernel structures */
341 method_reify (); fdchangecnt = 0; 368 fd_reify ();
342 369
343 /* calculate blocking time */ 370 /* calculate blocking time */
344 if (flags & EVLOOP_NONBLOCK) 371 if (flags & EVLOOP_NONBLOCK)
345 block = 0.; 372 block = 0.;
346 else 373 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines