Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

aio_cancel

Cancels outstanding asynchronous I/O requests for the file descriptor fd.

Syntax

int aio_cancel(HANDLE fd, struct aiocb *aiocbp);

Arguments

fd

File descriptor

*aiocbp

Pointer to control block from where asynchronous I/O request is generated

Description

The aio_cancel() function cancels outstanding asynchronous I/O requests for the file descriptor fd. If aiocbp is NULL, all outstanding asynchronous I/O requests are cancelled. If aiocbp is not NULL, only the requests described by the control block pointed to by aiocbp are cancelled.

Normal asynchronous notification occurs for cancelled requests. The request return status is set to -1, and the request error status is set to ECANCELED. The control block of requests that cannot be cancelled is not changed.

Unspecified results occur if aiocbp is not NULL and the fd differs from the file descriptor with which the asynchronous operation was initiated.

Returns

AIO_CANCELLED: When all specified requests are cancellled successfully.

AIO_NOTCANCELLED: When at least one of the specified requests is still in process of being cancelled; check the status of request using aio_error.

AIO_ALLDONE: When all specified requests were completed before cancel call was placed.

-1: When some error occurs. To get the correct error code, use errno.