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

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

117 117
118=item int ev_version_major () 118=item int ev_version_major ()
119 119
120=item int ev_version_minor () 120=item int ev_version_minor ()
121 121
122You can find out the major and minor API/ABI version numbers of the library 122You can find out the major and minor ABI version numbers of the library
123you linked against by calling the functions C<ev_version_major> and 123you linked against by calling the functions C<ev_version_major> and
124C<ev_version_minor>. If you want, you can compare against the global 124C<ev_version_minor>. If you want, you can compare against the global
125symbols C<EV_VERSION_MAJOR> and C<EV_VERSION_MINOR>, which specify the 125symbols C<EV_VERSION_MAJOR> and C<EV_VERSION_MINOR>, which specify the
126version of the library your program was compiled against. 126version of the library your program was compiled against.
127 127
128These version numbers refer to the API and ABI version of the library, not 128These version numbers refer to the ABI version of the library, not the
129the release version. 129release version.
130 130
131Usually, it's a good idea to terminate if the major versions mismatch, 131Usually, it's a good idea to terminate if the major versions mismatch,
132as this indicates an incompatible change. Minor versions are usually 132as this indicates an incompatible change. Minor versions are usually
133compatible to older versions, so a larger minor version alone is usually 133compatible to older versions, so a larger minor version alone is usually
134not a problem. 134not a problem.
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