… | |
… | |
3 | |
3 | |
4 | SYNOPSIS |
4 | SYNOPSIS |
5 | use Linux::AIO; |
5 | use Linux::AIO; |
6 | |
6 | |
7 | DESCRIPTION |
7 | DESCRIPTION |
8 | This module implements asynchronous i/o using the means available to |
8 | This module implements asynchronous I/O using the means available to |
9 | linux - clone. It does not hook into the POSIX aio_* functions because |
9 | Linux - clone. It does not hook into the POSIX aio_* functions because |
10 | linux does not yet support these in the kernel (and even if, it would |
10 | Linux does not yet support these in the kernel (even as of 2.6.12, only |
11 | only allow aio_read and write, not open and stat). |
11 | O_DIRECT files are supported) and even if, it would only allow aio_read |
|
|
12 | and write, not open, stat and so on. |
12 | |
13 | |
13 | Instead, in this module a number of (non-posix) threads are started that |
14 | Instead, in this module a number of (non-posix) threads are started that |
14 | execute your read/writes and signal their completion. You don't need |
15 | execute your read/writes and signal their completion. You don't need |
15 | thread support in your libc or perl, and the threads created by this |
16 | thread support in your libc or perl, and the threads created by this |
16 | module will not be visible to the pthreads library. |
17 | module will not be visible to the pthreads library. |
17 | |
18 | |
18 | NOTICE: the threads created by this module will automatically be killed |
19 | NOTICE: the threads created by this module will automatically be killed |
19 | when the thread calling min_parallel exits. Make sure you only ever call |
20 | when the thread calling min_parallel exits. Make sure you only ever call |
20 | min_parallel from the same thread that loaded this module. |
21 | min_parallel from the same thread that loaded this module. |
21 | |
22 | |
22 | Although the module will work with threads, it is not reentrant, so use |
23 | Although the module will work with in the presence of other threads, it |
23 | appropriate locking yourself. |
24 | is not reentrant, so use appropriate locking yourself. |
24 | |
25 | |
25 | Linux::AIO::min_parallel $nthreads |
26 | Linux::AIO::min_parallel $nthreads |
26 | Set the minimum number of AIO threads to $nthreads. The default is |
27 | 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 |
28 | 1, which means a single asynchronous operation can be done at one |
28 | time (the number of outstanding operations, however, is unlimited). |
29 | time (the number of outstanding operations, however, is unlimited). |