… | |
… | |
22 | poll => 'r', |
22 | poll => 'r', |
23 | cb => \&IO::AIO::poll_cb); |
23 | cb => \&IO::AIO::poll_cb); |
24 | |
24 | |
25 | # Glib/Gtk2 |
25 | # Glib/Gtk2 |
26 | add_watch Glib::IO IO::AIO::poll_fileno, |
26 | add_watch Glib::IO IO::AIO::poll_fileno, |
27 | \&IO::AIO::poll_cb; |
27 | sub { IO::AIO::poll_cb, 1 }; |
28 | |
28 | |
29 | # Tk |
29 | # Tk |
30 | Tk::Event::IO->fileevent (IO::AIO::poll_fileno, "", |
30 | Tk::Event::IO->fileevent (IO::AIO::poll_fileno, "", |
31 | readable => \&IO::AIO::poll_cb); |
31 | readable => \&IO::AIO::poll_cb); |
32 | |
32 | |
… | |
… | |
75 | |
75 | |
76 | =head2 AIO FUNCTIONS |
76 | =head2 AIO FUNCTIONS |
77 | |
77 | |
78 | All the C<aio_*> calls are more or less thin wrappers around the syscall |
78 | All the C<aio_*> calls are more or less thin wrappers around the syscall |
79 | with the same name (sans C<aio_>). The arguments are similar or identical, |
79 | with the same name (sans C<aio_>). The arguments are similar or identical, |
80 | and they all accept an additional C<$callback> argument which must be |
80 | and they all accept an additional (and optional) C<$callback> argument |
81 | a code reference. This code reference will get called with the syscall |
81 | which must be a code reference. This code reference will get called with |
82 | return code (e.g. most syscalls return C<-1> on error, unlike perl, which |
82 | the syscall return code (e.g. most syscalls return C<-1> on error, unlike |
83 | usually delivers "false") as it's sole argument when the given syscall has |
83 | perl, which usually delivers "false") as it's sole argument when the given |
84 | been executed asynchronously. |
84 | syscall has been executed asynchronously. |
85 | |
85 | |
86 | All functions that expect a filehandle will also accept a file descriptor. |
86 | All functions that expect a filehandle will also accept a file descriptor. |
87 | |
87 | |
88 | The filenames you pass to these routines I<must> be absolute. The reason |
88 | The filenames you pass to these routines I<must> be absolute. The reason |
89 | is that at the time the request is being executed, the current working |
89 | is that at the time the request is being executed, the current working |
… | |
… | |
237 | |
237 | |
238 | =item IO::AIO::flush |
238 | =item IO::AIO::flush |
239 | |
239 | |
240 | Wait till all outstanding AIO requests have been handled. |
240 | Wait till all outstanding AIO requests have been handled. |
241 | |
241 | |
|
|
242 | Strictly equivalent to: |
|
|
243 | |
|
|
244 | IO::AIO::poll_wait, IO::AIO::poll_cb |
|
|
245 | while IO::AIO::nreqs; |
|
|
246 | |
|
|
247 | =item IO::AIO::poll |
|
|
248 | |
|
|
249 | Waits until some requests have been handled. |
|
|
250 | |
|
|
251 | Strictly equivalent to: |
|
|
252 | |
|
|
253 | IO::AIO::poll_wait, IO::AIO::poll_cb |
|
|
254 | if IO::AIO::nreqs; |
|
|
255 | |
242 | =item IO::AIO::min_parallel $nthreads |
256 | =item IO::AIO::min_parallel $nthreads |
243 | |
257 | |
244 | Set the minimum number of AIO threads to C<$nthreads>. The default is |
258 | Set the minimum number of AIO threads to C<$nthreads>. The default is |
245 | C<1>, which means a single asynchronous operation can be done at one time |
259 | C<1>, which means a single asynchronous operation can be done at one time |
246 | (the number of outstanding operations, however, is unlimited). |
260 | (the number of outstanding operations, however, is unlimited). |