Extends the capabilities of the aio_nwait subroutine by specifying timeout values.
Standard C library (libc.a).
int aio_nwait_timeout (cnt, nwait, list, timeout)
int cnt;
int nwait;
struct aiocbp **list;
int timeout;
The aio_nwait_timeout subroutine waits for a certain number of asynchronous I/O operations to complete as specified by the nwait parameter, or until the call has blocked for a certain duration specified by the timeout parameter.
Item | Description |
---|---|
cnt | Indicates the maximum number of pointers to the aiocbp structure that can be copied into the list array. |
list | An array of pointers to aio control structures defined in the aio.h file. |
nwait | Specifies the number of asynchronous I/O operations that must complete before the aio_nwait_timout subroutine returns. |
timeout | Specified in units of milliseconds.
A timeout value of -1 indicates that the subroutine behaves like the aio_nwait subroutine, blocking until all of the requested I/O operations complete or until there are no more asynchronous I/O requests pending from the process. A timeout value of 0 indicates that the subroutine returns immediately with the current completed number of asynchronous I/O requests. All other positive timeout values indicate that the subroutine must block until either the timeout value is reached or the requested number of asynchronous I/O operations complete. |
The return value is the total number of requests the aio_nwait subroutine has waited on to complete. It can not be more than cnt. Although nwait is the desired amount of requests to find, the actual amount returned could be less than, equal to, or greater than nwait. The return value indicates how much of the list array to access.
The return value may be greater than the nwait value if the lio_listio subroutine initiated more than nwait requests and the cnt variable is larger than nwait. The nwait parameter represents a minimal value desired for the return value, and cnt is the maximum value possible for the return.
In the event of an error, the aio_nwait subroutine returns a value of -1 and sets the errno global variable to identify the error. Return codes can be set to the following errno values:
Item | Description |
---|---|
EBUSY | An aio_nwait call is in process. |
EINVAL | The application has retrieved all of the aiocb pointers, but the user buffer does not have enough space for them. |
EINVAL | There are no outstanding async I/O calls. |