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

Comparing libev/ev.h (file contents):
Revision 1.29 by root, Sun Nov 4 00:24:17 2007 UTC vs.
Revision 1.31 by root, Sun Nov 4 19:45:09 2007 UTC

210 210
211#if EV_PROTOTYPES 211#if EV_PROTOTYPES
212int ev_version_major (void); 212int ev_version_major (void);
213int ev_version_minor (void); 213int ev_version_minor (void);
214 214
215/* these three calls are suitable for plugging into pthread_atfork */
216void ev_fork_prepare (void);
217void ev_fork_parent (void);
218void ev_fork_child (void);
219
220ev_tstamp ev_time (void); 215ev_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 */
220struct ev_loop *ev_default_loop (int methods); /* returns default loop */
221
222/* create and destroy alternative loops that don't handle signals */
223struct ev_loop *ev_loop_new (int methods); 223struct ev_loop *ev_loop_new (int methods);
224void ev_loop_delete (EV_P); 224void ev_loop_destroy (EV_P);
225void ev_loop_fork (EV_P);
225# else 226# else
226int ev_init (int methods); /* returns ev_method */ 227int ev_default_loop (int methods); /* returns true when successful */
227# endif 228# endif
228 229
230void 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 :) */
235void ev_default_fork (void);
236
229int ev_method (EV_P); 237int 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 */
285void ev_io_start (EV_P_ struct ev_io *w); 293void ev_io_start (EV_P_ struct ev_io *w);
286void ev_io_stop (EV_P_ struct ev_io *w); 294void ev_io_stop (EV_P_ struct ev_io *w);
287 295
288void ev_timer_start (EV_P_ struct ev_timer *w); 296void ev_timer_start (EV_P_ struct ev_timer *w);
289void ev_timer_stop (EV_P_ struct ev_timer *w); 297void ev_timer_stop (EV_P_ struct ev_timer *w);
290void 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 */
299void ev_timer_again (EV_P_ struct ev_timer *w);
291 300
292void ev_periodic_start (EV_P_ struct ev_periodic *w); 301void ev_periodic_start (EV_P_ struct ev_periodic *w);
293void ev_periodic_stop (EV_P_ struct ev_periodic *w); 302void ev_periodic_stop (EV_P_ struct ev_periodic *w);
294 303
304void ev_idle_start (EV_P_ struct ev_idle *w);
305void ev_idle_stop (EV_P_ struct ev_idle *w);
306
307void ev_prepare_start (EV_P_ struct ev_prepare *w);
308void ev_prepare_stop (EV_P_ struct ev_prepare *w);
309
310void ev_check_start (EV_P_ struct ev_check *w);
311void ev_check_stop (EV_P_ struct ev_check *w);
312
313/* only supported in the default loop */
295void ev_signal_start (EV_P_ struct ev_signal *w); 314void ev_signal_start (EV_P_ struct ev_signal *w);
296void ev_signal_stop (EV_P_ struct ev_signal *w); 315void ev_signal_stop (EV_P_ struct ev_signal *w);
297 316
298void ev_idle_start (EV_P_ struct ev_idle *w); 317/* only supported in the default loop */
299void ev_idle_stop (EV_P_ struct ev_idle *w);
300
301void ev_prepare_start (EV_P_ struct ev_prepare *w);
302void ev_prepare_stop (EV_P_ struct ev_prepare *w);
303
304void ev_check_start (EV_P_ struct ev_check *w);
305void ev_check_stop (EV_P_ struct ev_check *w);
306
307void ev_child_start (EV_P_ struct ev_child *w); 318void ev_child_start (EV_P_ struct ev_child *w);
308void ev_child_stop (EV_P_ struct ev_child *w); 319void ev_child_stop (EV_P_ struct ev_child *w);
309#endif 320#endif
310 321
311#ifdef __cplusplus 322#ifdef __cplusplus

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines