aio_cancel()

Прервать асинхронную операцию ввода/вывода

Прототип:

#include <aio.h>
int aio_cancel( int fd,
struct aiocb *aiocbptr );

Аргументы:

fd
The file descriptor for which you want to cancel asynchronous I/O requests.
aiocbptr
A pointer to an asynchronous I/O control block of type struct aiocb for the request you want to cancel, or NULL if you want to cancel all requests against the file descriptor.

Библиотека:

libc

Описание:

The aio_cancel() function attempts to cancel one or more asynchronous I/O requests currently outstanding against a file descriptor.

Normal asynchronous notification occurs for asynchronous I/O operations that are successfully canceled. If there are requests that can't be canceled, then the normal asynchronous completion process takes place for those requests when they're completed.

The error status that's associated with requested operations that are successfully canceled is set to ECANCELED, and the return status is -1. The aio_cancel() function doesn't modify the struct aiocb structures for requested operations that aren't successfully canceled.

If aiocbptr isn't NULL, @ aio_cancel() ignores the fildes argument and attempts to cancel the I/O operation specified by the struct aiocb control block. The operation isn't cancelled if it's already in progress.

Возвращаемое значение:

AIO_CANCELED
The requested operation(s) were canceled.
AIO_NOTCANCELED
At least one of the requested operations couldn't be canceled because it was in progress.

Note: A return value of AIO_NOTCANCELED doesn't indicate the state of any other operations referenced in the call to aio_cancel(). To determine their status, use aio_error().

AIO_ALLDONE
All of the operations have already been completed.
-1
Возникла ошибка. Код ошибки записан в errno.

Коды ошибок:

EBADF
The filedes argument isn't a valid file descriptor.
EINVAL
The control block that aiocbptr points to isn't valid (i.e. it hasn't yet been used in any call to aio_read() or aio_write()).

Классификация:

POSIX 1003.1 AIO

Точка остановки потока
Нет
Обработчик прерываний
Нет
Обработчик сигналов
Да
В потоке
Да

Предостережения:

The first time you call an aio_*() function, a thread pool is created, making your process multithreaded if it isn't already. The thread pool isn't destroyed until your process ends.

Тематические ссылки:

aio_error(), aio_fsync(), aio_read(), aio_return(), aio_suspend(), aio_write(), struct aiocb




Предыдущий раздел: Описание API системной библиотеки