… | |
… | |
210 | |
210 | |
211 | #if EV_PROTOTYPES |
211 | #if EV_PROTOTYPES |
212 | int ev_version_major (void); |
212 | int ev_version_major (void); |
213 | int ev_version_minor (void); |
213 | int ev_version_minor (void); |
214 | |
214 | |
215 | /* these three calls are suitable for plugging into pthread_atfork */ |
|
|
216 | void ev_fork_prepare (void); |
|
|
217 | void ev_fork_parent (void); |
|
|
218 | void ev_fork_child (void); |
|
|
219 | |
|
|
220 | ev_tstamp ev_time (void); |
215 | ev_tstamp ev_time (void); |
221 | |
216 | |
222 | # if EV_MULTIPLICITY |
217 | # if EV_MULTIPLICITY |
|
|
218 | /* the default loop is the only one that handles signals and child watchers */ |
|
|
219 | /* you can call this as often as you like */ |
|
|
220 | struct ev_loop *ev_default_loop (int methods); /* returns default loop */ |
|
|
221 | |
|
|
222 | /* create and destroy alternative loops that don't handle signals */ |
223 | struct ev_loop *ev_loop_new (int methods); |
223 | struct ev_loop *ev_loop_new (int methods); |
224 | void ev_loop_delete (EV_P); |
224 | void ev_loop_destroy (EV_P); |
|
|
225 | void ev_loop_fork (EV_P); |
225 | # else |
226 | # else |
226 | int ev_init (int methods); /* returns ev_method */ |
227 | int ev_default_loop (int methods); /* returns true when successful */ |
227 | # endif |
228 | # endif |
228 | |
229 | |
|
|
230 | void ev_default_destroy (void); /* destroy the default loop */ |
|
|
231 | /* this needs to be called after fork, to duplicate the default loop */ |
|
|
232 | /* if you create alternative loops you have to call ev_loop_fork on them */ |
|
|
233 | /* you can call it in either the parent or the child */ |
|
|
234 | /* you can actually call it at any time, anywhere :) */ |
|
|
235 | void ev_default_fork (void); |
|
|
236 | |
229 | int ev_method (EV_P); |
237 | int ev_method (EV_P); |
230 | |
|
|
231 | #endif |
238 | #endif |
232 | |
239 | |
233 | #define EVLOOP_NONBLOCK 1 /* do not block/wait */ |
240 | #define EVLOOP_NONBLOCK 1 /* do not block/wait */ |
234 | #define EVLOOP_ONESHOT 2 /* block *once* only */ |
241 | #define EVLOOP_ONESHOT 2 /* block *once* only */ |
235 | #define EVUNLOOP_ONCE 1 /* unloop once */ |
242 | #define EVUNLOOP_ONCE 1 /* unloop once */ |
… | |
… | |
274 | #define ev_idle_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_idle_set ((ev)); } while (0) |
281 | #define ev_idle_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_idle_set ((ev)); } while (0) |
275 | #define ev_prepare_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0) |
282 | #define ev_prepare_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0) |
276 | #define ev_check_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_check_set ((ev)); } while (0) |
283 | #define ev_check_init(ev,cb) do { ev_watcher_init ((ev), (cb)); ev_check_set ((ev)); } while (0) |
277 | #define ev_child_init(ev,cb,pid) do { ev_watcher_init ((ev), (cb)); ev_child_set ((ev),(pid)); } while (0) |
284 | #define ev_child_init(ev,cb,pid) do { ev_watcher_init ((ev), (cb)); ev_child_set ((ev),(pid)); } while (0) |
278 | |
285 | |
|
|
286 | #define ev_is_pending(ev) (0 + (ev)->pending) /* true when watcher is waiting for callback invocation */ |
279 | #define ev_is_active(ev) (0 + (ev)->active) /* true when the watcher has been started */ |
287 | #define ev_is_active(ev) (0 + (ev)->active) /* true when the watcher has been started */ |
280 | #define ev_set_priority(ev,pri) (ev)->priority = pri |
288 | #define ev_set_priority(ev,pri) (ev)->priority = pri |
281 | |
289 | |
282 | /* stopping (enabling, adding) a watcher does nothing if it is already running */ |
290 | /* stopping (enabling, adding) a watcher does nothing if it is already running */ |
283 | /* stopping (disabling, deleting) a watcher does nothing unless its already running */ |
291 | /* stopping (disabling, deleting) a watcher does nothing unless its already running */ |
… | |
… | |
285 | void ev_io_start (EV_P_ struct ev_io *w); |
293 | void ev_io_start (EV_P_ struct ev_io *w); |
286 | void ev_io_stop (EV_P_ struct ev_io *w); |
294 | void ev_io_stop (EV_P_ struct ev_io *w); |
287 | |
295 | |
288 | void ev_timer_start (EV_P_ struct ev_timer *w); |
296 | void ev_timer_start (EV_P_ struct ev_timer *w); |
289 | void ev_timer_stop (EV_P_ struct ev_timer *w); |
297 | void ev_timer_stop (EV_P_ struct ev_timer *w); |
290 | void ev_timer_again (EV_P_ struct ev_timer *w); /* stops if active and no repeat, restarts if active and repeating, starts if inactive and repeating */ |
298 | /* stops if active and no repeat, restarts if active and repeating, starts if inactive and repeating */ |
|
|
299 | void ev_timer_again (EV_P_ struct ev_timer *w); |
291 | |
300 | |
292 | void ev_periodic_start (EV_P_ struct ev_periodic *w); |
301 | void ev_periodic_start (EV_P_ struct ev_periodic *w); |
293 | void ev_periodic_stop (EV_P_ struct ev_periodic *w); |
302 | void ev_periodic_stop (EV_P_ struct ev_periodic *w); |
294 | |
303 | |
|
|
304 | void ev_idle_start (EV_P_ struct ev_idle *w); |
|
|
305 | void ev_idle_stop (EV_P_ struct ev_idle *w); |
|
|
306 | |
|
|
307 | void ev_prepare_start (EV_P_ struct ev_prepare *w); |
|
|
308 | void ev_prepare_stop (EV_P_ struct ev_prepare *w); |
|
|
309 | |
|
|
310 | void ev_check_start (EV_P_ struct ev_check *w); |
|
|
311 | void ev_check_stop (EV_P_ struct ev_check *w); |
|
|
312 | |
|
|
313 | /* only supported in the default loop */ |
295 | void ev_signal_start (EV_P_ struct ev_signal *w); |
314 | void ev_signal_start (EV_P_ struct ev_signal *w); |
296 | void ev_signal_stop (EV_P_ struct ev_signal *w); |
315 | void ev_signal_stop (EV_P_ struct ev_signal *w); |
297 | |
316 | |
298 | void ev_idle_start (EV_P_ struct ev_idle *w); |
317 | /* only supported in the default loop */ |
299 | void ev_idle_stop (EV_P_ struct ev_idle *w); |
|
|
300 | |
|
|
301 | void ev_prepare_start (EV_P_ struct ev_prepare *w); |
|
|
302 | void ev_prepare_stop (EV_P_ struct ev_prepare *w); |
|
|
303 | |
|
|
304 | void ev_check_start (EV_P_ struct ev_check *w); |
|
|
305 | void ev_check_stop (EV_P_ struct ev_check *w); |
|
|
306 | |
|
|
307 | void ev_child_start (EV_P_ struct ev_child *w); |
318 | void ev_child_start (EV_P_ struct ev_child *w); |
308 | void ev_child_stop (EV_P_ struct ev_child *w); |
319 | void ev_child_stop (EV_P_ struct ev_child *w); |
309 | #endif |
320 | #endif |
310 | |
321 | |
311 | #ifdef __cplusplus |
322 | #ifdef __cplusplus |