… | |
… | |
69 | # define EV_DEFAULT_A |
69 | # define EV_DEFAULT_A |
70 | # define EV_DEFAULT_A_ |
70 | # define EV_DEFAULT_A_ |
71 | #endif |
71 | #endif |
72 | |
72 | |
73 | /* eventmask, revents, events... */ |
73 | /* eventmask, revents, events... */ |
74 | #define EV_UNDEF -1 /* guaranteed to be invalid */ |
74 | #define EV_UNDEF -1L /* guaranteed to be invalid */ |
75 | #define EV_NONE 0x00 |
75 | #define EV_NONE 0x00L |
76 | #define EV_READ 0x01 /* io only */ |
76 | #define EV_READ 0x01L /* io only */ |
77 | #define EV_WRITE 0x02 /* io only */ |
77 | #define EV_WRITE 0x02L /* io only */ |
78 | #define EV_TIMEOUT 0x000100 /* timer only */ |
78 | #define EV_TIMEOUT 0x000100L /* timer only */ |
79 | #define EV_PERIODIC 0x000200 /* periodic timer only */ |
79 | #define EV_PERIODIC 0x000200L /* periodic timer only */ |
80 | #define EV_SIGNAL 0x000400 /* signal only */ |
80 | #define EV_SIGNAL 0x000400L /* signal only */ |
81 | #define EV_IDLE 0x000800 /* idle only */ |
81 | #define EV_IDLE 0x000800L /* idle only */ |
82 | #define EV_CHECK 0x001000 /* check only */ |
82 | #define EV_CHECK 0x001000L /* check only */ |
83 | #define EV_PREPARE 0x002000 /* prepare only */ |
83 | #define EV_PREPARE 0x002000L /* prepare only */ |
84 | #define EV_CHILD 0x004000 /* child/pid only */ |
84 | #define EV_CHILD 0x004000L /* child/pid only */ |
85 | #define EV_ERROR 0x800000 /* sent when an error occurs */ |
85 | #define EV_ERROR 0x800000L /* sent when an error occurs */ |
86 | |
86 | |
87 | /* can be used to add custom fields to all watchers, while losing binary compatibility */ |
87 | /* can be used to add custom fields to all watchers, while losing binary compatibility */ |
88 | #ifndef EV_COMMON |
88 | #ifndef EV_COMMON |
89 | # define EV_COMMON void *data; |
89 | # define EV_COMMON void *data; |
90 | #endif |
90 | #endif |
… | |
… | |
231 | struct ev_child child; |
231 | struct ev_child child; |
232 | }; |
232 | }; |
233 | |
233 | |
234 | /* bits for ev_default_loop and ev_loop_new */ |
234 | /* bits for ev_default_loop and ev_loop_new */ |
235 | /* the default */ |
235 | /* the default */ |
236 | #define EVFLAG_AUTO 0x00000000 /* not quite a mask */ |
236 | #define EVFLAG_AUTO 0x00000000UL /* not quite a mask */ |
237 | |
237 | /* flag bits */ |
|
|
238 | #define EVFLAG_NOENV 0x01000000UL /* do NOT consult environment */ |
238 | /* method bits to be ored together */ |
239 | /* method bits to be ored together */ |
239 | #define EVMETHOD_SELECT 0x00000001 /* about anywhere */ |
240 | #define EVBACKEND_SELECT 0x00000001UL /* about anywhere */ |
240 | #define EVMETHOD_POLL 0x00000002 /* !win */ |
241 | #define EVBACKEND_POLL 0x00000002UL /* !win */ |
241 | #define EVMETHOD_EPOLL 0x00000004 /* linux */ |
242 | #define EVBACKEND_EPOLL 0x00000004UL /* linux */ |
242 | #define EVMETHOD_KQUEUE 0x00000008 /* bsd */ |
243 | #define EVBACKEND_KQUEUE 0x00000008UL /* bsd */ |
243 | #define EVMETHOD_DEVPOLL 0x00000010 /* solaris 8 */ /* NYI */ |
244 | #define EVBACKEND_DEVPOLL 0x00000010UL /* solaris 8 */ /* NYI */ |
244 | #define EVMETHOD_PORT 0x00000020 /* solaris 10 */ /* NYI */ |
245 | #define EVBACKEND_PORT 0x00000020UL /* solaris 10 */ |
245 | |
|
|
246 | /* flag bits */ |
|
|
247 | #define EVFLAG_NOENV 0x01000000 /* do NOT consult environment */ |
|
|
248 | |
246 | |
249 | #if EV_PROTOTYPES |
247 | #if EV_PROTOTYPES |
250 | int ev_version_major (void); |
248 | int ev_version_major (void); |
251 | int ev_version_minor (void); |
249 | int ev_version_minor (void); |
|
|
250 | |
|
|
251 | unsigned int ev_supported_backends (void); |
|
|
252 | unsigned int ev_recommended_backends (void); |
252 | |
253 | |
253 | ev_tstamp ev_time (void); |
254 | ev_tstamp ev_time (void); |
254 | |
255 | |
255 | /* Sets the allocation function to use, works like realloc. |
256 | /* Sets the allocation function to use, works like realloc. |
256 | * It is used to allocate and free memory. |
257 | * It is used to allocate and free memory. |
… | |
… | |
267 | void ev_set_syserr_cb (void (*cb)(const char *msg)); |
268 | void ev_set_syserr_cb (void (*cb)(const char *msg)); |
268 | |
269 | |
269 | # if EV_MULTIPLICITY |
270 | # if EV_MULTIPLICITY |
270 | /* the default loop is the only one that handles signals and child watchers */ |
271 | /* the default loop is the only one that handles signals and child watchers */ |
271 | /* you can call this as often as you like */ |
272 | /* you can call this as often as you like */ |
272 | struct ev_loop *ev_default_loop (unsigned int flags); /* returns default loop */ |
273 | static struct ev_loop * |
|
|
274 | ev_default_loop (unsigned int flags) |
|
|
275 | { |
|
|
276 | extern struct ev_loop *ev_default_loop_ptr; |
|
|
277 | extern struct ev_loop *ev_default_loop_init (unsigned int flags); |
|
|
278 | |
|
|
279 | if (!ev_default_loop_ptr) |
|
|
280 | ev_default_loop_init (flags); |
|
|
281 | |
|
|
282 | return ev_default_loop_ptr; |
|
|
283 | } |
273 | |
284 | |
274 | /* create and destroy alternative loops that don't handle signals */ |
285 | /* create and destroy alternative loops that don't handle signals */ |
275 | struct ev_loop *ev_loop_new (unsigned int flags); |
286 | struct ev_loop *ev_loop_new (unsigned int flags); |
276 | void ev_loop_destroy (EV_P); |
287 | void ev_loop_destroy (EV_P); |
277 | void ev_loop_fork (EV_P); |
288 | void ev_loop_fork (EV_P); |
… | |
… | |
296 | /* if you create alternative loops you have to call ev_loop_fork on them */ |
307 | /* if you create alternative loops you have to call ev_loop_fork on them */ |
297 | /* you can call it in either the parent or the child */ |
308 | /* you can call it in either the parent or the child */ |
298 | /* you can actually call it at any time, anywhere :) */ |
309 | /* you can actually call it at any time, anywhere :) */ |
299 | void ev_default_fork (void); |
310 | void ev_default_fork (void); |
300 | |
311 | |
301 | unsigned int ev_method (EV_P); |
312 | unsigned int ev_backend (EV_P); |
302 | #endif |
313 | #endif |
303 | |
314 | |
304 | #define EVLOOP_NONBLOCK 1 /* do not block/wait */ |
315 | #define EVLOOP_NONBLOCK 1 /* do not block/wait */ |
305 | #define EVLOOP_ONESHOT 2 /* block *once* only */ |
316 | #define EVLOOP_ONESHOT 2 /* block *once* only */ |
306 | #define EVUNLOOP_ONE 1 /* unloop once */ |
317 | #define EVUNLOOP_ONE 1 /* unloop once */ |