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

Comparing libev/ev.c (file contents):
Revision 1.293 by root, Mon Jun 29 18:46:52 2009 UTC vs.
Revision 1.295 by root, Wed Jul 8 04:29:31 2009 UTC

391# define inline_speed static noinline 391# define inline_speed static noinline
392#else 392#else
393# define inline_speed static inline 393# define inline_speed static inline
394#endif 394#endif
395 395
396#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) 396#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
397
398#if EV_MINPRI == EV_MAXPRI
399# define ABSPRI(w) (((W)w), 0)
400#else
397#define ABSPRI(w) (((W)w)->priority - EV_MINPRI) 401# define ABSPRI(w) (((W)w)->priority - EV_MINPRI)
402#endif
398 403
399#define EMPTY /* required for microsofts broken pseudo-c compiler */ 404#define EMPTY /* required for microsofts broken pseudo-c compiler */
400#define EMPTY2(a,b) /* used to suppress some warnings */ 405#define EMPTY2(a,b) /* used to suppress some warnings */
401 406
402typedef ev_watcher *W; 407typedef ev_watcher *W;
1358ev_loop_count (EV_P) 1363ev_loop_count (EV_P)
1359{ 1364{
1360 return loop_count; 1365 return loop_count;
1361} 1366}
1362 1367
1368unsigned int
1369ev_loop_depth (EV_P)
1370{
1371 return loop_depth;
1372}
1373
1363void 1374void
1364ev_set_io_collect_interval (EV_P_ ev_tstamp interval) 1375ev_set_io_collect_interval (EV_P_ ev_tstamp interval)
1365{ 1376{
1366 io_blocktime = interval; 1377 io_blocktime = interval;
1367} 1378}
2020 2031
2021 mn_now = ev_rt_now; 2032 mn_now = ev_rt_now;
2022 } 2033 }
2023} 2034}
2024 2035
2025static int loop_done;
2026
2027void 2036void
2028ev_loop (EV_P_ int flags) 2037ev_loop (EV_P_ int flags)
2029{ 2038{
2039 ++loop_depth;
2040
2030 loop_done = EVUNLOOP_CANCEL; 2041 loop_done = EVUNLOOP_CANCEL;
2031 2042
2032 call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */ 2043 call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */
2033 2044
2034 do 2045 do
2149 && !(flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK)) 2160 && !(flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK))
2150 )); 2161 ));
2151 2162
2152 if (loop_done == EVUNLOOP_ONE) 2163 if (loop_done == EVUNLOOP_ONE)
2153 loop_done = EVUNLOOP_CANCEL; 2164 loop_done = EVUNLOOP_CANCEL;
2165
2166 --loop_depth;
2154} 2167}
2155 2168
2156void 2169void
2157ev_unloop (EV_P_ int how) 2170ev_unloop (EV_P_ int how)
2158{ 2171{
2250} 2263}
2251 2264
2252inline_size void 2265inline_size void
2253pri_adjust (EV_P_ W w) 2266pri_adjust (EV_P_ W w)
2254{ 2267{
2255 int pri = w->priority; 2268 int pri = ev_priority (w);
2256 pri = pri < EV_MINPRI ? EV_MINPRI : pri; 2269 pri = pri < EV_MINPRI ? EV_MINPRI : pri;
2257 pri = pri > EV_MAXPRI ? EV_MAXPRI : pri; 2270 pri = pri > EV_MAXPRI ? EV_MAXPRI : pri;
2258 w->priority = pri; 2271 ev_set_priority (w, pri);
2259} 2272}
2260 2273
2261inline_speed void 2274inline_speed void
2262ev_start (EV_P_ W w, int active) 2275ev_start (EV_P_ W w, int active)
2263{ 2276{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines