aio_suspend() - wait for an asynchronous I/O operation to complete
int aio_suspend(const struct aiocb * const list, int nent, const
struct timespec *timeout);
The aio_suspend() function suspends the calling process or thread
until at least one of the asynchronous I/O operations initiated with
one of the nent aiocb pointers contained in list has completed, or a
signal interrupts the function, or timeout is not NULL and the time
interval specified by timeout has passed.
Multiple threads may issue simultaneous calls to aio_suspend(),
referencing one or more aiocbs in common.
To use this function, link in the realtime library by specifying -lrt
on the compiler or linker command line.
aio_suspend() returns the following values:
0 Successful completion. Either there were no non-
NULL aiocbs in list or at least one of the
asynchronous I/O operations enqueued for an aiocb
referenced by list has completed. The completion
status of the referenced asynchronous I/O
operations must be determined using aio_error()
and aio_return() for each relevant aiocb.
-1 Failure. The process thread is not suspended and
errno is set to indicate the error.
If any of the indicated asynchronous I/O operations has already
completed at the time of the call to aio_suspend(), then aio_suspend()
returns immediately. If nent is 0 (zero), the aio_suspend()
immediately returns success. Any NULL aiocb in list is silently
ignored. If all of the aiocbs in list are NULL, the aio_suspend()
immediately returns success.
If aio_suspend() detects one of the following error conditions, errno
is set to the indicated value:
[EAGAIN] System-wide or per-process resources were not
available to process the request.
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
[EAGAIN] The time interval specified in the timespec
referenced by timeout passed before any of the
asynchronous I/O operations enqueued for one of
the aiocb entries referenced in list completed.
[EINVAL] The value of the nent argument was negative or
exceeded the maximum value allowed. The maximum
value allowed can be obtained using the sysconf()
call with the argument _SC_AIO_MAX.
[EINVAL] One or more of the aiocb pointers in list does not
identify an asynchronous operation enqueued by
aio_read(), aio_write(), or lio_listio(), and for
which aio_return() has not yet been called. aiocb
pointers associated with aio_fsync() will yield
[EINTR] A signal was delivered to the process while
aio_suspend() was waiting. Completion of
asynchronous operations can cause signal delivery.
aio_cancel(2), aio_error(2), aio_fsync(2), aio_read(2), aio_return(2),
aio_write(2), lio_listio(2), suspend(2), aio(5).
aio_suspend(): POSIX Realtime Extensions, IEEE Std 1003.1b
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000