… | |
… | |
176 | { |
176 | { |
177 | loop = EV_DEFAULT; |
177 | loop = EV_DEFAULT; |
178 | |
178 | |
179 | ev_idle_init (&repeat_watcher, repeat); |
179 | ev_idle_init (&repeat_watcher, repeat); |
180 | ev_async_init (&ready_watcher, ready); |
180 | ev_async_init (&ready_watcher, ready); |
181 | ev_async_start (loop &watcher); |
181 | ev_async_start (loop, &watcher); |
182 | |
182 | |
183 | eio_init (want_poll, 0); |
183 | eio_init (want_poll, 0); |
184 | } |
184 | } |
185 | |
185 | |
186 | For most other event loops, you would typically use a pipe - the event |
186 | For most other event loops, you would typically use a pipe - the event |
… | |
… | |
290 | |
290 | |
291 | Cancel the request (and all its subrequests). If the request is currently |
291 | Cancel the request (and all its subrequests). If the request is currently |
292 | executing it might still continue to execute, and in other cases it might |
292 | executing it might still continue to execute, and in other cases it might |
293 | still take a while till the request is cancelled. |
293 | still take a while till the request is cancelled. |
294 | |
294 | |
295 | Even if cancelled, the finish callback will still be invoked - the |
295 | When cancelled, the finish callback will not be invoked. |
296 | callbacks of all cancellable requests need to check whether the request |
|
|
297 | has been cancelled by calling C<EIO_CANCELLED (req)>: |
|
|
298 | |
|
|
299 | static int |
|
|
300 | my_eio_cb (eio_req *req) |
|
|
301 | { |
|
|
302 | if (EIO_CANCELLED (req)) |
|
|
303 | return 0; |
|
|
304 | } |
|
|
305 | |
|
|
306 | In addition, cancelled requests will I<either> have C<< req->result >> |
|
|
307 | set to C<-1> and C<errno> to C<ECANCELED>, or I<otherwise> they were |
|
|
308 | successfully executed, despite being cancelled (e.g. when they have |
|
|
309 | already been executed at the time they were cancelled). |
|
|
310 | |
296 | |
311 | C<EIO_CANCELLED> is still true for requests that have successfully |
297 | C<EIO_CANCELLED> is still true for requests that have successfully |
312 | executed, as long as C<eio_cancel> was called on them at some point. |
298 | executed, as long as C<eio_cancel> was called on them at some point. |
313 | |
299 | |
314 | =back |
300 | =back |