… | |
… | |
1128 | and sets errno to C<ENOSYS>. |
1128 | and sets errno to C<ENOSYS>. |
1129 | |
1129 | |
1130 | Note that the corresponding C<munlock> is synchronous and is |
1130 | Note that the corresponding C<munlock> is synchronous and is |
1131 | documented under L<MISCELLANEOUS FUNCTIONS>. |
1131 | documented under L<MISCELLANEOUS FUNCTIONS>. |
1132 | |
1132 | |
|
|
1133 | Example: open a file, mmap and mlock it - both will be undone when |
|
|
1134 | C<$data> gets destroyed. |
|
|
1135 | |
|
|
1136 | open my $fh, "<", $path or die "$path: $!"; |
|
|
1137 | my $data; |
|
|
1138 | IO::AIO::mmap $data, -s $fh, IO::AIO::PROT_READ, IO::AIO::MAP_SHARED, $fh; |
|
|
1139 | aio_mlock $data; # mlock in background |
|
|
1140 | |
1133 | =item aio_mlockall $flags, $callback->($status) |
1141 | =item aio_mlockall $flags, $callback->($status) |
1134 | |
1142 | |
1135 | Calls the C<mlockall> function with the given C<$flags> (a combination of |
1143 | Calls the C<mlockall> function with the given C<$flags> (a combination of |
1136 | C<IO::AIO::MCL_CURRENT> and C<IO::AIO::MCL_FUTURE>). |
1144 | C<IO::AIO::MCL_CURRENT> and C<IO::AIO::MCL_FUTURE>). |
1137 | |
1145 | |
1138 | On systems that do not implement C<mlockall>, this function returns C<-1> |
1146 | On systems that do not implement C<mlockall>, this function returns C<-1> |
1139 | and sets errno to C<ENOSYS>. |
1147 | and sets errno to C<ENOSYS>. |
1140 | |
1148 | |
1141 | Note that the corresponding C<munlockall> is synchronous and is |
1149 | Note that the corresponding C<munlockall> is synchronous and is |
1142 | documented under L<MISCELLANEOUS FUNCTIONS>. |
1150 | documented under L<MISCELLANEOUS FUNCTIONS>. |
|
|
1151 | |
|
|
1152 | Example: asynchronously lock all current and future pages into memory. |
|
|
1153 | |
|
|
1154 | aio_mlockall IO::AIO::MCL_FUTURE; |
1143 | |
1155 | |
1144 | =item aio_group $callback->(...) |
1156 | =item aio_group $callback->(...) |
1145 | |
1157 | |
1146 | This is a very special aio request: Instead of doing something, it is a |
1158 | This is a very special aio request: Instead of doing something, it is a |
1147 | container for other aio requests, which is useful if you want to bundle |
1159 | container for other aio requests, which is useful if you want to bundle |