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

Comparing libev/ev.c (file contents):
Revision 1.17 by root, Wed Oct 31 14:44:15 2007 UTC vs.
Revision 1.19 by root, Wed Oct 31 17:55:55 2007 UTC

39#include <assert.h> 39#include <assert.h>
40#include <errno.h> 40#include <errno.h>
41#include <sys/time.h> 41#include <sys/time.h>
42#include <time.h> 42#include <time.h>
43 43
44#define HAVE_EPOLL 1
45
46#ifndef HAVE_MONOTONIC 44#ifndef HAVE_MONOTONIC
47# ifdef CLOCK_MONOTONIC 45# ifdef CLOCK_MONOTONIC
48# define HAVE_MONOTONIC 1 46# define HAVE_MONOTONIC 1
49# endif 47# endif
50#endif 48#endif
188 186
189 for (i = 0; i < eventcnt; ++i) 187 for (i = 0; i < eventcnt; ++i)
190 event (events [i], type); 188 event (events [i], type);
191} 189}
192 190
191/* called on EBADF to verify fds */
192static void
193fd_recheck ()
194{
195 int fd;
196
197 for (fd = 0; fd < anfdmax; ++fd)
198 if (anfds [fd].wev)
199 if (fcntl (fd, F_GETFD) == -1 && errno == EBADF)
200 while (anfds [fd].head)
201 evio_stop (anfds [fd].head);
202}
203
193/*****************************************************************************/ 204/*****************************************************************************/
194 205
195static struct ev_timer **timers; 206static struct ev_timer **timers;
196static int timermax, timercnt; 207static int timermax, timercnt;
197 208
416} 427}
417 428
418static void 429static void
419call_pending () 430call_pending ()
420{ 431{
421 int i; 432 while (pendingcnt)
422
423 for (i = 0; i < pendingcnt; ++i)
424 { 433 {
425 ANPENDING *p = pendings + i; 434 ANPENDING *p = pendings + --pendingcnt;
426 435
427 if (p->w) 436 if (p->w)
428 { 437 {
429 p->w->pending = 0; 438 p->w->pending = 0;
430 p->w->cb (p->w, p->events); 439 p->w->cb (p->w, p->events);
431 } 440 }
432 } 441 }
433
434 pendingcnt = 0;
435} 442}
436 443
437static void 444static void
438timers_reify () 445timers_reify ()
439{ 446{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines