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

Comparing libev/ev.3 (file contents):
Revision 1.119 by root, Wed Jan 22 02:00:13 2020 UTC vs.
Revision 1.120 by root, Wed Jan 22 13:33:44 2020 UTC

1349with a watcher-specific start function (\f(CW\*(C`ev_TYPE_start (loop, watcher 1349with a watcher-specific start function (\f(CW\*(C`ev_TYPE_start (loop, watcher
1350*)\*(C'\fR), and you can stop watching for events at any time by calling the 1350*)\*(C'\fR), and you can stop watching for events at any time by calling the
1351corresponding stop function (\f(CW\*(C`ev_TYPE_stop (loop, watcher *)\*(C'\fR. 1351corresponding stop function (\f(CW\*(C`ev_TYPE_stop (loop, watcher *)\*(C'\fR.
1352.PP 1352.PP
1353As long as your watcher is active (has been started but not stopped) you 1353As long as your watcher is active (has been started but not stopped) you
1354must not touch the values stored in it. Most specifically you must never 1354must not touch the values stored in it except when explicitly documented
1355reinitialise it or call its \f(CW\*(C`ev_TYPE_set\*(C'\fR macro. 1355otherwise. Most specifically you must never reinitialise it or call its
1356\&\f(CW\*(C`ev_TYPE_set\*(C'\fR macro.
1356.PP 1357.PP
1357Each and every callback receives the event loop pointer as first, the 1358Each and every callback receives the event loop pointer as first, the
1358registered watcher structure as second, and a bitset of received events as 1359registered watcher structure as second, and a bitset of received events as
1359third argument. 1360third argument.
1360.PP 1361.PP
1953.PD 0 1954.PD 0
1954.IP "ev_io_set (ev_io *, int fd, int events)" 4 1955.IP "ev_io_set (ev_io *, int fd, int events)" 4
1955.IX Item "ev_io_set (ev_io *, int fd, int events)" 1956.IX Item "ev_io_set (ev_io *, int fd, int events)"
1956.PD 1957.PD
1957Configures an \f(CW\*(C`ev_io\*(C'\fR watcher. The \f(CW\*(C`fd\*(C'\fR is the file descriptor to 1958Configures an \f(CW\*(C`ev_io\*(C'\fR watcher. The \f(CW\*(C`fd\*(C'\fR is the file descriptor to
1958receive events for and \f(CW\*(C`events\*(C'\fR is either \f(CW\*(C`EV_READ\*(C'\fR, \f(CW\*(C`EV_WRITE\*(C'\fR or 1959receive events for and \f(CW\*(C`events\*(C'\fR is either \f(CW\*(C`EV_READ\*(C'\fR, \f(CW\*(C`EV_WRITE\*(C'\fR, both
1959\&\f(CW\*(C`EV_READ | EV_WRITE\*(C'\fR, to express the desire to receive the given events. 1960\&\f(CW\*(C`EV_READ | EV_WRITE\*(C'\fR or \f(CW0\fR, to express the desire to receive the given
1961events.
1962.Sp
1963Note that setting the \f(CW\*(C`events\*(C'\fR to \f(CW0\fR and starting the watcher is
1964supported, but not specially optimized \- if your program sometimes happens
1965to generate this combination this is fine, but if it is easy to avoid
1966starting an io watcher watching for no events you should do so.
1960.IP "ev_io_modify (ev_io *, int events)" 4 1967.IP "ev_io_modify (ev_io *, int events)" 4
1961.IX Item "ev_io_modify (ev_io *, int events)" 1968.IX Item "ev_io_modify (ev_io *, int events)"
1962Similar to \f(CW\*(C`ev_io_set\*(C'\fR, but only changes the event mask. Using this might 1969Similar to \f(CW\*(C`ev_io_set\*(C'\fR, but only changes the event mask. Using this might
1963be faster with some backends, as libev can assume that the \f(CW\*(C`fd\*(C'\fR still 1970be faster with some backends, as libev can assume that the \f(CW\*(C`fd\*(C'\fR still
1964refers to the same underlying file description, something it cannot do 1971refers to the same underlying file description, something it cannot do
1968The file descriptor being watched. While it can be read at any time, you 1975The file descriptor being watched. While it can be read at any time, you
1969must not modify this member even when the watcher is stopped \- always use 1976must not modify this member even when the watcher is stopped \- always use
1970\&\f(CW\*(C`ev_io_set\*(C'\fR for that. 1977\&\f(CW\*(C`ev_io_set\*(C'\fR for that.
1971.IP "int events [no\-modify]" 4 1978.IP "int events [no\-modify]" 4
1972.IX Item "int events [no-modify]" 1979.IX Item "int events [no-modify]"
1973The set of events being watched, among other flags. This field is a 1980The set of events the fd is being watched for, among other flags. Remember
1974bit set \- to test for \f(CW\*(C`EV_READ\*(C'\fR, use \f(CW\*(C`w\->events & EV_READ\*(C'\fR, and 1981that this is a bit set \- to test for \f(CW\*(C`EV_READ\*(C'\fR, use \f(CW\*(C`w\->events &
1975similarly for \f(CW\*(C`EV_WRITE\*(C'\fR. 1982EV_READ\*(C'\fR, and similarly for \f(CW\*(C`EV_WRITE\*(C'\fR.
1976.Sp 1983.Sp
1977As with \f(CW\*(C`fd\*(C'\fR, you must not modify this member even when the watcher is 1984As with \f(CW\*(C`fd\*(C'\fR, you must not modify this member even when the watcher is
1978stopped, always use \f(CW\*(C`ev_io_set\*(C'\fR or \f(CW\*(C`ev_io_modify\*(C'\fR for that. 1985stopped, always use \f(CW\*(C`ev_io_set\*(C'\fR or \f(CW\*(C`ev_io_modify\*(C'\fR for that.
1979.PP 1986.PP
1980\fIExamples\fR 1987\fIExamples\fR
4411gets automatically stopped and restarted when reconfiguring it with this 4418gets automatically stopped and restarted when reconfiguring it with this
4412method. 4419method.
4413.Sp 4420.Sp
4414For \f(CW\*(C`ev::embed\*(C'\fR watchers this method is called \f(CW\*(C`set_embed\*(C'\fR, to avoid 4421For \f(CW\*(C`ev::embed\*(C'\fR watchers this method is called \f(CW\*(C`set_embed\*(C'\fR, to avoid
4415clashing with the \f(CW\*(C`set (loop)\*(C'\fR method. 4422clashing with the \f(CW\*(C`set (loop)\*(C'\fR method.
4423.Sp
4424For \f(CW\*(C`ev::io\*(C'\fR watchers there is an additional \f(CW\*(C`set\*(C'\fR method that acepts a
4425new event mask only, and internally calls \f(CW\*(C`ev_io_modfify\*(C'\fR.
4416.IP "w\->start ()" 4 4426.IP "w\->start ()" 4
4417.IX Item "w->start ()" 4427.IX Item "w->start ()"
4418Starts the watcher. Note that there is no \f(CW\*(C`loop\*(C'\fR argument, as the 4428Starts the watcher. Note that there is no \f(CW\*(C`loop\*(C'\fR argument, as the
4419constructor already stores the event loop. 4429constructor already stores the event loop.
4420.IP "w\->start ([arguments])" 4 4430.IP "w\->start ([arguments])" 4

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines