… | |
… | |
117 | aio_write $fh,$offset,$length, $data,$dataoffset,$callback |
117 | aio_write $fh,$offset,$length, $data,$dataoffset,$callback |
118 | Reads or writes "length" bytes from the specified "fh" and "offset" |
118 | Reads or writes "length" bytes from the specified "fh" and "offset" |
119 | into the scalar given by "data" and offset "dataoffset" and calls |
119 | into the scalar given by "data" and offset "dataoffset" and calls |
120 | the callback without the actual number of bytes read (or -1 on |
120 | the callback without the actual number of bytes read (or -1 on |
121 | error, just like the syscall). |
121 | error, just like the syscall). |
|
|
122 | |
|
|
123 | The $data scalar *MUST NOT* be modified in any way while the request |
|
|
124 | is outstanding. Modifying it can result in segfaults or WW3 (if the |
|
|
125 | necessary/optional hardware is installed). |
122 | |
126 | |
123 | Example: Read 15 bytes at offset 7 into scalar $buffer, starting at |
127 | Example: Read 15 bytes at offset 7 into scalar $buffer, starting at |
124 | offset 0 within the scalar: |
128 | offset 0 within the scalar: |
125 | |
129 | |
126 | aio_read $fh, 7, 15, $buffer, 0, sub { |
130 | aio_read $fh, 7, 15, $buffer, 0, sub { |
… | |
… | |
271 | if you set this to a relatively low number, such as 100. |
275 | if you set this to a relatively low number, such as 100. |
272 | |
276 | |
273 | Under normal circumstances you don't need to call this function. |
277 | Under normal circumstances you don't need to call this function. |
274 | |
278 | |
275 | FORK BEHAVIOUR |
279 | FORK BEHAVIOUR |
276 | IO::AIO handles all outstanding AIO requests before the fork, destroys |
280 | Before the fork IO::AIO enters a quiescent state where no requests can |
277 | all AIO threads, and recreates them in both the parent and the child |
281 | be added in other threads and no results will be processed. After the |
278 | after the fork. |
282 | fork the parent simply leaves the quiescent state and continues |
|
|
283 | request/result processing, while the child clears the request/result |
|
|
284 | queue and starts the same number of threads as were in use by the |
|
|
285 | parent. |
279 | |
286 | |
280 | SEE ALSO |
287 | SEE ALSO |
281 | Coro, Linux::AIO. |
288 | Coro, Linux::AIO. |
282 | |
289 | |
283 | AUTHOR |
290 | AUTHOR |