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

Comparing libev/ev.c (file contents):
Revision 1.338 by root, Tue Mar 16 00:20:17 2010 UTC vs.
Revision 1.341 by root, Tue Mar 16 20:48:29 2010 UTC

79# endif 79# endif
80# endif 80# endif
81 81
82# ifndef EV_USE_NANOSLEEP 82# ifndef EV_USE_NANOSLEEP
83# if HAVE_NANOSLEEP 83# if HAVE_NANOSLEEP
84# define EV_USE_NANOSLEEP 1 84# define EV_USE_NANOSLEEP EV_FEATURE_OS
85# else 85# else
86# define EV_USE_NANOSLEEP 0 86# define EV_USE_NANOSLEEP 0
87# endif 87# endif
88# endif 88# endif
89 89
90# ifndef EV_USE_SELECT 90# ifndef EV_USE_SELECT
91# if HAVE_SELECT && HAVE_SYS_SELECT_H 91# if HAVE_SELECT && HAVE_SYS_SELECT_H
92# define EV_USE_SELECT 1 92# define EV_USE_SELECT EV_FEATURE_BACKENDS
93# else 93# else
94# define EV_USE_SELECT 0 94# define EV_USE_SELECT 0
95# endif 95# endif
96# endif 96# endif
97 97
98# ifndef EV_USE_POLL 98# ifndef EV_USE_POLL
99# if HAVE_POLL && HAVE_POLL_H 99# if HAVE_POLL && HAVE_POLL_H
100# define EV_USE_POLL 1 100# define EV_USE_POLL EV_FEATURE_BACKENDS
101# else 101# else
102# define EV_USE_POLL 0 102# define EV_USE_POLL 0
103# endif 103# endif
104# endif 104# endif
105 105
106# ifndef EV_USE_EPOLL 106# ifndef EV_USE_EPOLL
107# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H 107# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H
108# define EV_USE_EPOLL 1 108# define EV_USE_EPOLL EV_FEATURE_BACKENDS
109# else 109# else
110# define EV_USE_EPOLL 0 110# define EV_USE_EPOLL 0
111# endif 111# endif
112# endif 112# endif
113 113
114# ifndef EV_USE_KQUEUE 114# ifndef EV_USE_KQUEUE
115# if HAVE_KQUEUE && HAVE_SYS_EVENT_H 115# if HAVE_KQUEUE && HAVE_SYS_EVENT_H
116# define EV_USE_KQUEUE 1 116# define EV_USE_KQUEUE EV_FEATURE_BACKENDS
117# else 117# else
118# define EV_USE_KQUEUE 0 118# define EV_USE_KQUEUE 0
119# endif 119# endif
120# endif 120# endif
121 121
122# ifndef EV_USE_PORT 122# ifndef EV_USE_PORT
123# if HAVE_PORT_H && HAVE_PORT_CREATE 123# if HAVE_PORT_H && HAVE_PORT_CREATE
124# define EV_USE_PORT 1 124# define EV_USE_PORT EV_FEATURE_BACKENDS
125# else 125# else
126# define EV_USE_PORT 0 126# define EV_USE_PORT 0
127# endif 127# endif
128# endif 128# endif
129 129
130# ifndef EV_USE_INOTIFY 130# ifndef EV_USE_INOTIFY
131# if HAVE_INOTIFY_INIT && HAVE_SYS_INOTIFY_H 131# if HAVE_INOTIFY_INIT && HAVE_SYS_INOTIFY_H
132# define EV_USE_INOTIFY 1 132# define EV_USE_INOTIFY EV_FEATURE_OS
133# else 133# else
134# define EV_USE_INOTIFY 0 134# define EV_USE_INOTIFY 0
135# endif 135# endif
136# endif 136# endif
137 137
138# ifndef EV_USE_SIGNALFD 138# ifndef EV_USE_SIGNALFD
139# if HAVE_SIGNALFD && HAVE_SYS_SIGNALFD_H 139# if HAVE_SIGNALFD && HAVE_SYS_SIGNALFD_H
140# define EV_USE_SIGNALFD 1 140# define EV_USE_SIGNALFD EV_FEATURE_OS
141# else 141# else
142# define EV_USE_SIGNALFD 0 142# define EV_USE_SIGNALFD 0
143# endif 143# endif
144# endif 144# endif
145 145
146# ifndef EV_USE_EVENTFD 146# ifndef EV_USE_EVENTFD
147# if HAVE_EVENTFD 147# if HAVE_EVENTFD
148# define EV_USE_EVENTFD 1 148# define EV_USE_EVENTFD EV_FEATURE_OS
149# else 149# else
150# define EV_USE_EVENTFD 0 150# define EV_USE_EVENTFD 0
151# endif 151# endif
152# endif 152# endif
153 153
435 435
436 436
437/**/ 437/**/
438 438
439#if EV_VERIFY >= 3 439#if EV_VERIFY >= 3
440# define EV_FREQUENT_CHECK ev_loop_verify (EV_A) 440# define EV_FREQUENT_CHECK ev_verify (EV_A)
441#else 441#else
442# define EV_FREQUENT_CHECK do { } while (0) 442# define EV_FREQUENT_CHECK do { } while (0)
443#endif 443#endif
444 444
445/* 445/*
1531 return backend; 1531 return backend;
1532} 1532}
1533 1533
1534#if EV_FEATURE_API 1534#if EV_FEATURE_API
1535unsigned int 1535unsigned int
1536ev_loop_count (EV_P) 1536ev_iteration (EV_P)
1537{ 1537{
1538 return loop_count; 1538 return loop_count;
1539} 1539}
1540 1540
1541unsigned int 1541unsigned int
1542ev_loop_depth (EV_P) 1542ev_depth (EV_P)
1543{ 1543{
1544 return loop_depth; 1544 return loop_depth;
1545} 1545}
1546 1546
1547void 1547void
1868} 1868}
1869#endif 1869#endif
1870 1870
1871#if EV_FEATURE_API 1871#if EV_FEATURE_API
1872void 1872void
1873ev_loop_verify (EV_P) 1873ev_verify (EV_P)
1874{ 1874{
1875#if EV_VERIFY 1875#if EV_VERIFY
1876 int i; 1876 int i;
1877 WL w; 1877 WL w;
1878 1878
2096 EV_FREQUENT_CHECK; 2096 EV_FREQUENT_CHECK;
2097 feed_reverse (EV_A_ (W)w); 2097 feed_reverse (EV_A_ (W)w);
2098 } 2098 }
2099 while (timercnt && ANHE_at (timers [HEAP0]) < mn_now); 2099 while (timercnt && ANHE_at (timers [HEAP0]) < mn_now);
2100 2100
2101 feed_reverse_done (EV_A_ EV_TIMEOUT); 2101 feed_reverse_done (EV_A_ EV_TIMER);
2102 } 2102 }
2103} 2103}
2104 2104
2105#if EV_PERIODIC_ENABLE 2105#if EV_PERIODIC_ENABLE
2106/* make periodics pending */ 2106/* make periodics pending */
2280 EV_INVOKE_PENDING; /* in case we recurse, ensure ordering stays nice and clean */ 2280 EV_INVOKE_PENDING; /* in case we recurse, ensure ordering stays nice and clean */
2281 2281
2282 do 2282 do
2283 { 2283 {
2284#if EV_VERIFY >= 2 2284#if EV_VERIFY >= 2
2285 ev_loop_verify (EV_A); 2285 ev_verify (EV_A);
2286#endif 2286#endif
2287 2287
2288#ifndef _WIN32 2288#ifndef _WIN32
2289 if (expect_false (curpid)) /* penalise the forking check even more */ 2289 if (expect_false (curpid)) /* penalise the forking check even more */
2290 if (expect_false (getpid () != curpid)) 2290 if (expect_false (getpid () != curpid))
3636{ 3636{
3637 struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once)); 3637 struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once));
3638 3638
3639 if (expect_false (!once)) 3639 if (expect_false (!once))
3640 { 3640 {
3641 cb (EV_ERROR | EV_READ | EV_WRITE | EV_TIMEOUT, arg); 3641 cb (EV_ERROR | EV_READ | EV_WRITE | EV_TIMER, arg);
3642 return; 3642 return;
3643 } 3643 }
3644 3644
3645 once->cb = cb; 3645 once->cb = cb;
3646 once->arg = arg; 3646 once->arg = arg;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines