… | |
… | |
25 | Linux::AIO::min_parallel $nthreads |
25 | Linux::AIO::min_parallel $nthreads |
26 | Set the minimum number of AIO threads to $nthreads. The default is |
26 | Set the minimum number of AIO threads to $nthreads. The default is |
27 | 1, which means a single asynchronous operation can be done at one |
27 | 1, which means a single asynchronous operation can be done at one |
28 | time (the number of outstanding operations, however, is unlimited). |
28 | time (the number of outstanding operations, however, is unlimited). |
29 | |
29 | |
30 | It is recommended to keep the number of threads low, as many linux |
30 | It is recommended to keep the number of threads low, as some linux |
31 | kernel versions will scale negatively with the number of threads |
31 | kernel versions will scale negatively with the number of threads |
32 | (higher parallelity => MUCH higher latency). |
32 | (higher parallelity => MUCH higher latency). |
|
|
33 | |
|
|
34 | Linux::AIO::max_parallel $nthreads |
|
|
35 | Sets the maximum number of AIO threads to $nthreads. If more than |
|
|
36 | the specified number of threads are currently running, kill them. |
|
|
37 | This function blocks until the limit is reached. |
|
|
38 | |
|
|
39 | This module automatically runs "max_parallel 0" at program end, to |
|
|
40 | ensure that all threads are killed and that there are no outstanding |
|
|
41 | requests. |
33 | |
42 | |
34 | $fileno = Linux::AIO::poll_fileno |
43 | $fileno = Linux::AIO::poll_fileno |
35 | Return the *request result pipe filehandle*. This filehandle must be |
44 | Return the *request result pipe filehandle*. This filehandle must be |
36 | polled for reading by some mechanism outside this module (e.g. Event |
45 | polled for reading by some mechanism outside this module (e.g. Event |
37 | or select, see below). If the pipe becomes readable you have to call |
46 | or select, see below). If the pipe becomes readable you have to call |
… | |
… | |
45 | You can use Event to multiplex, e.g.: |
54 | You can use Event to multiplex, e.g.: |
46 | |
55 | |
47 | Event->io (fd => Linux::AIO::poll_fileno, |
56 | Event->io (fd => Linux::AIO::poll_fileno, |
48 | poll => 'r', async => 1, |
57 | poll => 'r', async => 1, |
49 | cb => \&Linux::AIO::poll_cb ); |
58 | cb => \&Linux::AIO::poll_cb ); |
|
|
59 | |
|
|
60 | Linux::AIO::poll_wait |
|
|
61 | Wait till the result filehandle becomes ready for reading (simply |
|
|
62 | does a select on the filehandle. This is useful if you want to |
|
|
63 | synchronously wait for some requests to finish). |
50 | |
64 | |
51 | Linux::AIO::nreqs |
65 | Linux::AIO::nreqs |
52 | Returns the number of requests currently outstanding. |
66 | Returns the number of requests currently outstanding. |
53 | |
67 | |
54 | aio_open $pathname, $flags, $mode, $callback |
68 | aio_open $pathname, $flags, $mode, $callback |