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

Comparing libev/ev.h (file contents):
Revision 1.52 by root, Mon Nov 12 00:31:08 2007 UTC vs.
Revision 1.62 by root, Thu Nov 22 12:28:27 2007 UTC

201struct ev_check 201struct ev_check
202{ 202{
203 EV_WATCHER (ev_check) 203 EV_WATCHER (ev_check)
204}; 204};
205 205
206/* invoked when sigchld is received and waitpid indicates the givne pid */ 206/* invoked when sigchld is received and waitpid indicates the given pid */
207/* revent EV_CHILD */ 207/* revent EV_CHILD */
208/* does not support priorities */ 208/* does not support priorities */
209struct ev_child 209struct ev_child
210{ 210{
211 EV_WATCHER_LIST (ev_child) 211 EV_WATCHER_LIST (ev_child)
229 struct ev_check check; 229 struct ev_check check;
230 struct ev_signal signal; 230 struct ev_signal signal;
231 struct ev_child child; 231 struct ev_child child;
232}; 232};
233 233
234#define EVMETHOD_AUTO 0 /* consults environment */ 234/* bits for ev_default_loop and ev_loop_new */
235#define EVMETHOD_SELECT 1 235/* the default */
236#define EVMETHOD_POLL 2 236#define EVFLAG_AUTO 0x00000000 /* not quite a mask */
237#define EVMETHOD_EPOLL 4 237
238#define EVMETHOD_KQUEUE 8 238/* method bits to be ored together */
239#define EVMETHOD_DEVPOLL 16 /* NYI */ 239#define EVMETHOD_SELECT 0x00000001 /* about anywhere */
240#define EVMETHOD_PORT 32 /* NYI */ 240#define EVMETHOD_POLL 0x00000002 /* !win */
241#define EVMETHOD_WIN32 64 /* NYI */ 241#define EVMETHOD_EPOLL 0x00000004 /* linux */
242#define EVMETHOD_ANY ~0 /* any method, do not consult env */ 242#define EVMETHOD_KQUEUE 0x00000008 /* bsd */
243#define EVMETHOD_DEVPOLL 0x00000010 /* solaris 8 */ /* NYI */
244#define EVMETHOD_PORT 0x00000020 /* solaris 10 */
245#define EVMETHOD_ALL 0x0000ffff /* all methods, also future ones, or so */
246
247/* flag bits */
248#define EVFLAG_NOENV 0x01000000 /* do NOT consult environment */
243 249
244#if EV_PROTOTYPES 250#if EV_PROTOTYPES
245int ev_version_major (void); 251int ev_version_major (void);
246int ev_version_minor (void); 252int ev_version_minor (void);
247 253
262void ev_set_syserr_cb (void (*cb)(const char *msg)); 268void ev_set_syserr_cb (void (*cb)(const char *msg));
263 269
264# if EV_MULTIPLICITY 270# if EV_MULTIPLICITY
265/* 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 */
266/* you can call this as often as you like */ 272/* you can call this as often as you like */
267struct ev_loop *ev_default_loop (int methods); /* returns default loop */ 273static struct ev_loop *
274ev_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}
268 284
269/* create and destroy alternative loops that don't handle signals */ 285/* create and destroy alternative loops that don't handle signals */
270struct ev_loop *ev_loop_new (int methods); 286struct ev_loop *ev_loop_new (unsigned int flags);
271void ev_loop_destroy (EV_P); 287void ev_loop_destroy (EV_P);
272void ev_loop_fork (EV_P); 288void ev_loop_fork (EV_P);
273 289
274ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */ 290ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
275 291
276# else 292# else
277 293
278int ev_default_loop (int methods); /* returns true when successful */ 294int ev_default_loop (unsigned int flags); /* returns true when successful */
279 295
280static ev_tstamp 296static ev_tstamp
281ev_now (void) 297ev_now (void)
282{ 298{
283 extern ev_tstamp ev_rt_now; 299 extern ev_tstamp ev_rt_now;
291/* 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 */
292/* you can call it in either the parent or the child */ 308/* you can call it in either the parent or the child */
293/* you can actually call it at any time, anywhere :) */ 309/* you can actually call it at any time, anywhere :) */
294void ev_default_fork (void); 310void ev_default_fork (void);
295 311
296int ev_method (EV_P); 312unsigned int ev_method (EV_P);
297#endif 313#endif
298 314
299#define EVLOOP_NONBLOCK 1 /* do not block/wait */ 315#define EVLOOP_NONBLOCK 1 /* do not block/wait */
300#define EVLOOP_ONESHOT 2 /* block *once* only */ 316#define EVLOOP_ONESHOT 2 /* block *once* only */
301#define EVUNLOOP_ONCE 1 /* unloop once */ 317#define EVUNLOOP_ONE 1 /* unloop once */
302#define EVUNLOOP_ALL 2 /* unloop all loops */ 318#define EVUNLOOP_ALL 2 /* unloop all loops */
303 319
304#if EV_PROTOTYPES 320#if EV_PROTOTYPES
305void ev_loop (EV_P_ int flags); 321void ev_loop (EV_P_ int flags);
306void ev_unloop (EV_P_ int how); /* set to 1 to break out of event loop, set to 2 to break out of all event loops */ 322void ev_unloop (EV_P_ int how); /* set to 1 to break out of event loop, set to 2 to break out of all event loops */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines