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

Comparing libeio/eio.pod (file contents):
Revision 1.15 by root, Tue Jul 5 16:57:41 2011 UTC vs.
Revision 1.16 by root, Tue Jul 5 17:05:54 2011 UTC

130 130
131If C<eio_poll ()> is configured to not handle all results in one go 131If C<eio_poll ()> is configured to not handle all results in one go
132(i.e. it returns C<-1>) then you should start an idle watcher that calls 132(i.e. it returns C<-1>) then you should start an idle watcher that calls
133C<eio_poll> until it returns something C<!= -1>. 133C<eio_poll> until it returns something C<!= -1>.
134 134
135A full-featured wrapper would look as follows (if C<eio_poll> is handling 135A full-featured conenctor between libeio and libev would look as follows
136all requests, it can of course be simplified a lot by removing the idle 136(if C<eio_poll> is handling all requests, it can of course be simplified a
137watcher logic): 137lot by removing the idle watcher logic):
138 138
139 static struct ev_loop *loop; 139 static struct ev_loop *loop;
140 static ev_idle repeat_watcher; 140 static ev_idle repeat_watcher;
141 static ev_async ready_watcher; 141 static ev_async ready_watcher;
142 142
178 178
179For most other event loops, you would typically use a pipe - the event 179For most other event loops, you would typically use a pipe - the event
180loop should be told to wait for read readiness on the read end. In 180loop should be told to wait for read readiness on the read end. In
181C<want_poll> you would write a single byte, in C<done_poll> you would try 181C<want_poll> you would write a single byte, in C<done_poll> you would try
182to read that byte, and in the callback for the read end, you would call 182to read that byte, and in the callback for the read end, you would call
183C<eio_poll>. The race is avoided here because the event loop should invoke 183C<eio_poll>.
184your callback again and again until the byte has been read (as the pipe 184
185read callback does not read it, only C<done_poll>). 185You don't have to take special care in the case C<eio_poll> doesn't handle
186all requests, as the done callback will not be invoked, so the event loop
187will still signal readyness for the pipe until I<all> results have been
188processed.
186 189
187 190
188=head1 HIGH LEVEL REQUEST API 191=head1 HIGH LEVEL REQUEST API
189 192
190Libeio has both a high-level API, which consists of calling a request 193Libeio has both a high-level API, which consists of calling a request

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines