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

Comparing libev/ev.3 (file contents):
Revision 1.37 by root, Fri Dec 7 16:49:49 2007 UTC vs.
Revision 1.38 by root, Fri Dec 7 18:09:38 2007 UTC

1040it is best to always use non-blocking I/O: An extra \f(CW\*(C`read\*(C'\fR(2) returning 1040it is best to always use non-blocking I/O: An extra \f(CW\*(C`read\*(C'\fR(2) returning
1041\&\f(CW\*(C`EAGAIN\*(C'\fR is far preferable to a program hanging until some data arrives. 1041\&\f(CW\*(C`EAGAIN\*(C'\fR is far preferable to a program hanging until some data arrives.
1042.PP 1042.PP
1043If you cannot run the fd in non-blocking mode (for example you should not 1043If you cannot run the fd in non-blocking mode (for example you should not
1044play around with an Xlib connection), then you have to seperately re-test 1044play around with an Xlib connection), then you have to seperately re-test
1045wether a file descriptor is really ready with a known-to-be good interface 1045whether a file descriptor is really ready with a known-to-be good interface
1046such as poll (fortunately in our Xlib example, Xlib already does this on 1046such as poll (fortunately in our Xlib example, Xlib already does this on
1047its own, so its quite safe to use). 1047its own, so its quite safe to use).
1048.IP "ev_io_init (ev_io *, callback, int fd, int events)" 4 1048.IP "ev_io_init (ev_io *, callback, int fd, int events)" 4
1049.IX Item "ev_io_init (ev_io *, callback, int fd, int events)" 1049.IX Item "ev_io_init (ev_io *, callback, int fd, int events)"
1050.PD 0 1050.PD 0
1991\& } 1991\& }
1992.Ve 1992.Ve
1993.SH "MACRO MAGIC" 1993.SH "MACRO MAGIC"
1994.IX Header "MACRO MAGIC" 1994.IX Header "MACRO MAGIC"
1995Libev can be compiled with a variety of options, the most fundemantal is 1995Libev can be compiled with a variety of options, the most fundemantal is
1996\&\f(CW\*(C`EV_MULTIPLICITY\*(C'\fR. This option determines wether (most) functions and 1996\&\f(CW\*(C`EV_MULTIPLICITY\*(C'\fR. This option determines whether (most) functions and
1997callbacks have an initial \f(CW\*(C`struct ev_loop *\*(C'\fR argument. 1997callbacks have an initial \f(CW\*(C`struct ev_loop *\*(C'\fR argument.
1998.PP 1998.PP
1999To make it easier to write programs that cope with either variant, the 1999To make it easier to write programs that cope with either variant, the
2000following macros are defined: 2000following macros are defined:
2001.ie n .IP """EV_A""\fR, \f(CW""EV_A_""" 4 2001.ie n .IP """EV_A""\fR, \f(CW""EV_A_""" 4
2037.IX Item "EV_DEFAULT, EV_DEFAULT_" 2037.IX Item "EV_DEFAULT, EV_DEFAULT_"
2038Similar to the other two macros, this gives you the value of the default 2038Similar to the other two macros, this gives you the value of the default
2039loop, if multiple loops are supported (\*(L"ev loop default\*(R"). 2039loop, if multiple loops are supported (\*(L"ev loop default\*(R").
2040.PP 2040.PP
2041Example: Declare and initialise a check watcher, utilising the above 2041Example: Declare and initialise a check watcher, utilising the above
2042macros so it will work regardless of wether multiple loops are supported 2042macros so it will work regardless of whether multiple loops are supported
2043or not. 2043or not.
2044.PP 2044.PP
2045.Vb 5 2045.Vb 5
2046\& static void 2046\& static void
2047\& check_cb (EV_P_ ev_timer *w, int revents) 2047\& check_cb (EV_P_ ev_timer *w, int revents)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines