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

Comparing libev/ev.c (file contents):
Revision 1.184 by root, Wed Dec 12 05:30:52 2007 UTC vs.
Revision 1.188 by root, Thu Dec 20 07:12:57 2007 UTC

202#ifndef CLOCK_REALTIME 202#ifndef CLOCK_REALTIME
203# undef EV_USE_REALTIME 203# undef EV_USE_REALTIME
204# define EV_USE_REALTIME 0 204# define EV_USE_REALTIME 0
205#endif 205#endif
206 206
207#if !EV_STAT_ENABLE
208# undef EV_USE_INOTIFY
209# define EV_USE_INOTIFY 0
210#endif
211
212#if EV_USE_INOTIFY
213# include <sys/inotify.h>
214#endif
215
207#if EV_SELECT_IS_WINSOCKET 216#if EV_SELECT_IS_WINSOCKET
208# include <winsock.h> 217# include <winsock.h>
209#endif
210
211#if !EV_STAT_ENABLE
212# define EV_USE_INOTIFY 0
213#endif
214
215#if EV_USE_INOTIFY
216# include <sys/inotify.h>
217#endif 218#endif
218 219
219/**/ 220/**/
220 221
221/* 222/*
230 231
231#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */ 232#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
232#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */ 233#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */
233/*#define CLEANUP_INTERVAL (MAX_BLOCKTIME * 5.) /* how often to try to free memory and re-check fds, TODO */ 234/*#define CLEANUP_INTERVAL (MAX_BLOCKTIME * 5.) /* how often to try to free memory and re-check fds, TODO */
234 235
235#if __GNUC__ >= 3 236#if __GNUC__ >= 4
236# define expect(expr,value) __builtin_expect ((expr),(value)) 237# define expect(expr,value) __builtin_expect ((expr),(value))
237# define noinline __attribute__ ((noinline)) 238# define noinline __attribute__ ((noinline))
238#else 239#else
239# define expect(expr,value) (expr) 240# define expect(expr,value) (expr)
240# define noinline 241# define noinline
1037#if EV_IDLE_ENABLE 1038#if EV_IDLE_ENABLE
1038 array_free (idle, [i]); 1039 array_free (idle, [i]);
1039#endif 1040#endif
1040 } 1041 }
1041 1042
1043 ev_free (anfds); anfdmax = 0;
1044
1042 /* have to use the microsoft-never-gets-it-right macro */ 1045 /* have to use the microsoft-never-gets-it-right macro */
1043 array_free (fdchange, EMPTY); 1046 array_free (fdchange, EMPTY);
1044 array_free (timer, EMPTY); 1047 array_free (timer, EMPTY);
1045#if EV_PERIODIC_ENABLE 1048#if EV_PERIODIC_ENABLE
1046 array_free (periodic, EMPTY); 1049 array_free (periodic, EMPTY);
1050#endif
1051#if EV_FORK_ENABLE
1052 array_free (fork, EMPTY);
1047#endif 1053#endif
1048 array_free (prepare, EMPTY); 1054 array_free (prepare, EMPTY);
1049 array_free (check, EMPTY); 1055 array_free (check, EMPTY);
1050 1056
1051 backend = 0; 1057 backend = 0;
2176 2182
2177#if EV_EMBED_ENABLE 2183#if EV_EMBED_ENABLE
2178void noinline 2184void noinline
2179ev_embed_sweep (EV_P_ ev_embed *w) 2185ev_embed_sweep (EV_P_ ev_embed *w)
2180{ 2186{
2181 ev_loop (w->loop, EVLOOP_NONBLOCK); 2187 ev_loop (w->other, EVLOOP_NONBLOCK);
2182} 2188}
2183 2189
2184static void 2190static void
2185embed_cb (EV_P_ ev_io *io, int revents) 2191embed_cb (EV_P_ ev_io *io, int revents)
2186{ 2192{
2197{ 2203{
2198 if (expect_false (ev_is_active (w))) 2204 if (expect_false (ev_is_active (w)))
2199 return; 2205 return;
2200 2206
2201 { 2207 {
2202 struct ev_loop *loop = w->loop; 2208 struct ev_loop *loop = w->other;
2203 assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ())); 2209 assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
2204 ev_io_init (&w->io, embed_cb, backend_fd, EV_READ); 2210 ev_io_init (&w->io, embed_cb, backend_fd, EV_READ);
2205 } 2211 }
2206 2212
2207 ev_set_priority (&w->io, ev_priority (w)); 2213 ev_set_priority (&w->io, ev_priority (w));
2314 ev_timer_set (&once->to, timeout, 0.); 2320 ev_timer_set (&once->to, timeout, 0.);
2315 ev_timer_start (EV_A_ &once->to); 2321 ev_timer_start (EV_A_ &once->to);
2316 } 2322 }
2317} 2323}
2318 2324
2325#if EV_MULTIPLICITY
2326 #include "ev_wrap.h"
2327#endif
2328
2319#ifdef __cplusplus 2329#ifdef __cplusplus
2320} 2330}
2321#endif 2331#endif
2322 2332

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines