… | |
… | |
33 | syscall has been executed asynchronously. |
33 | syscall has been executed asynchronously. |
34 | |
34 | |
35 | All functions that expect a filehandle will also accept a file |
35 | All functions that expect a filehandle will also accept a file |
36 | descriptor. |
36 | descriptor. |
37 | |
37 | |
|
|
38 | The filenames you pass to these routines *must* be absolute. The reason |
|
|
39 | is that at the time the request is being executed, the current working |
|
|
40 | directory could have changed. Alternatively, you can make sure that you |
|
|
41 | never change the current working directory. |
|
|
42 | |
38 | Linux::AIO::min_parallel $nthreads |
43 | Linux::AIO::min_parallel $nthreads |
39 | Set the minimum number of AIO threads to $nthreads. The default is |
44 | Set the minimum number of AIO threads to $nthreads. The default is |
40 | 1, which means a single asynchronous operation can be done at one |
45 | 1, which means a single asynchronous operation can be done at one |
41 | time (the number of outstanding operations, however, is unlimited). |
46 | time (the number of outstanding operations, however, is unlimited). |
42 | |
47 | |
… | |
… | |
87 | Linux::AIO::nreqs |
92 | Linux::AIO::nreqs |
88 | Returns the number of requests currently outstanding. |
93 | Returns the number of requests currently outstanding. |
89 | |
94 | |
90 | Example: wait till there are no outstanding requests anymore: |
95 | Example: wait till there are no outstanding requests anymore: |
91 | |
96 | |
92 | Linux::AIO::poll_wait while Linux::AIO::nreqs; |
97 | Linux::AIO::poll_wait, Linux::AIO::poll_cb |
|
|
98 | while Linux::AIO::nreqs; |
93 | |
99 | |
94 | aio_open $pathname, $flags, $mode, $callback |
100 | aio_open $pathname, $flags, $mode, $callback |
95 | Asynchronously open or create a file and call the callback with the |
101 | Asynchronously open or create a file and call the callback with the |
96 | filedescriptor (NOT a perl filehandle, sorry for that, but watch |
102 | filedescriptor (NOT a perl filehandle, sorry for that, but watch |
97 | out, this might change in the future). |
103 | out, this might change in the future). |
|
|
104 | |
|
|
105 | The pathname passed to "aio_open" must be absolute. See API NOTES, |
|
|
106 | above, for an explanation. |
98 | |
107 | |
99 | The $mode argument is a bitmask. See the "Fcntl" module for a list. |
108 | The $mode argument is a bitmask. See the "Fcntl" module for a list. |
100 | They are the same as used in "sysopen". |
109 | They are the same as used in "sysopen". |
101 | |
110 | |
102 | Example: |
111 | Example: |
… | |
… | |
149 | aio_lstat $fh, $callback |
158 | aio_lstat $fh, $callback |
150 | Works like perl's "stat" or "lstat" in void context. The callback |
159 | Works like perl's "stat" or "lstat" in void context. The callback |
151 | will be called after the stat and the results will be available |
160 | will be called after the stat and the results will be available |
152 | using "stat _" or "-s _" etc... |
161 | using "stat _" or "-s _" etc... |
153 | |
162 | |
|
|
163 | The pathname passed to "aio_stat" must be absolute. See API NOTES, |
|
|
164 | above, for an explanation. |
|
|
165 | |
154 | Currently, the stats are always 64-bit-stats, i.e. instead of |
166 | Currently, the stats are always 64-bit-stats, i.e. instead of |
155 | returning an error when stat'ing a large file, the results will be |
167 | returning an error when stat'ing a large file, the results will be |
156 | silently truncated unless perl itself is compiled with large file |
168 | silently truncated unless perl itself is compiled with large file |
157 | support. |
169 | support. |
158 | |
170 | |
… | |
… | |
180 | webserver for many years now. |
192 | webserver for many years now. |
181 | |
193 | |
182 | - aio_open gives a fd, but all other functions expect a perl filehandle. |
194 | - aio_open gives a fd, but all other functions expect a perl filehandle. |
183 | |
195 | |
184 | SEE ALSO |
196 | SEE ALSO |
185 | Coro. |
197 | Coro, IO::AIO. |
186 | |
198 | |
187 | AUTHOR |
199 | AUTHOR |
188 | Marc Lehmann <schmorp@schmorp.de> |
200 | Marc Lehmann <schmorp@schmorp.de> |
189 | http://home.schmorp.de/ |
201 | http://home.schmorp.de/ |
190 | |
202 | |