--- libev/ev.3 2020/01/22 02:00:13 1.119 +++ libev/ev.3 2020/01/22 13:33:44 1.120 @@ -1351,8 +1351,9 @@ corresponding stop function (\f(CW\*(C`ev_TYPE_stop (loop, watcher *)\*(C'\fR. .PP As long as your watcher is active (has been started but not stopped) you -must not touch the values stored in it. Most specifically you must never -reinitialise it or call its \f(CW\*(C`ev_TYPE_set\*(C'\fR macro. +must not touch the values stored in it except when explicitly documented +otherwise. Most specifically you must never reinitialise it or call its +\&\f(CW\*(C`ev_TYPE_set\*(C'\fR macro. .PP Each and every callback receives the event loop pointer as first, the registered watcher structure as second, and a bitset of received events as @@ -1955,8 +1956,14 @@ .IX Item "ev_io_set (ev_io *, int fd, int events)" .PD Configures an \f(CW\*(C`ev_io\*(C'\fR watcher. The \f(CW\*(C`fd\*(C'\fR is the file descriptor to -receive 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 -\&\f(CW\*(C`EV_READ | EV_WRITE\*(C'\fR, to express the desire to receive the given events. +receive 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 +\&\f(CW\*(C`EV_READ | EV_WRITE\*(C'\fR or \f(CW0\fR, to express the desire to receive the given +events. +.Sp +Note that setting the \f(CW\*(C`events\*(C'\fR to \f(CW0\fR and starting the watcher is +supported, but not specially optimized \- if your program sometimes happens +to generate this combination this is fine, but if it is easy to avoid +starting an io watcher watching for no events you should do so. .IP "ev_io_modify (ev_io *, int events)" 4 .IX Item "ev_io_modify (ev_io *, int events)" Similar to \f(CW\*(C`ev_io_set\*(C'\fR, but only changes the event mask. Using this might @@ -1970,9 +1977,9 @@ \&\f(CW\*(C`ev_io_set\*(C'\fR for that. .IP "int events [no\-modify]" 4 .IX Item "int events [no-modify]" -The set of events being watched, among other flags. This field is a -bit set \- to test for \f(CW\*(C`EV_READ\*(C'\fR, use \f(CW\*(C`w\->events & EV_READ\*(C'\fR, and -similarly for \f(CW\*(C`EV_WRITE\*(C'\fR. +The set of events the fd is being watched for, among other flags. Remember +that this is a bit set \- to test for \f(CW\*(C`EV_READ\*(C'\fR, use \f(CW\*(C`w\->events & +EV_READ\*(C'\fR, and similarly for \f(CW\*(C`EV_WRITE\*(C'\fR. .Sp As with \f(CW\*(C`fd\*(C'\fR, you must not modify this member even when the watcher is stopped, always use \f(CW\*(C`ev_io_set\*(C'\fR or \f(CW\*(C`ev_io_modify\*(C'\fR for that. @@ -4413,6 +4420,9 @@ .Sp For \f(CW\*(C`ev::embed\*(C'\fR watchers this method is called \f(CW\*(C`set_embed\*(C'\fR, to avoid clashing with the \f(CW\*(C`set (loop)\*(C'\fR method. +.Sp +For \f(CW\*(C`ev::io\*(C'\fR watchers there is an additional \f(CW\*(C`set\*(C'\fR method that acepts a +new event mask only, and internally calls \f(CW\*(C`ev_io_modfify\*(C'\fR. .IP "w\->start ()" 4 .IX Item "w->start ()" Starts the watcher. Note that there is no \f(CW\*(C`loop\*(C'\fR argument, as the