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

Comparing libev/ev.pod (file contents):
Revision 1.80 by root, Sun Dec 9 19:47:30 2007 UTC vs.
Revision 1.81 by root, Wed Dec 12 04:53:58 2007 UTC

911play around with an Xlib connection), then you have to seperately re-test 911play around with an Xlib connection), then you have to seperately re-test
912whether a file descriptor is really ready with a known-to-be good interface 912whether a file descriptor is really ready with a known-to-be good interface
913such as poll (fortunately in our Xlib example, Xlib already does this on 913such as poll (fortunately in our Xlib example, Xlib already does this on
914its own, so its quite safe to use). 914its own, so its quite safe to use).
915 915
916=head3 The special problem of disappearing file descriptors
917
918Some backends (e.g kqueue, epoll) need to be told about closing a file
919descriptor (either by calling C<close> explicitly or by any other means,
920such as C<dup>). The reason is that you register interest in some file
921descriptor, but when it goes away, the operating system will silently drop
922this interest. If another file descriptor with the same number then is
923registered with libev, there is no efficient way to see that this is, in
924fact, a different file descriptor.
925
926To avoid having to explicitly tell libev about such cases, libev follows
927the following policy: Each time C<ev_io_set> is being called, libev
928will assume that this is potentially a new file descriptor, otherwise
929it is assumed that the file descriptor stays the same. That means that
930you I<have> to call C<ev_io_set> (or C<ev_io_init>) when you change the
931descriptor even if the file descriptor number itself did not change.
932
933This is how one would do it normally anyway, the important point is that
934the libev application should not optimise around libev but should leave
935optimisations to libev.
936
937
916=over 4 938=over 4
917 939
918=item ev_io_init (ev_io *, callback, int fd, int events) 940=item ev_io_init (ev_io *, callback, int fd, int events)
919 941
920=item ev_io_set (ev_io *, int fd, int events) 942=item ev_io_set (ev_io *, int fd, int events)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines