HPlogo HP-UX Reference > A

aio_suspend(2)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

aio_suspend() — wait for an asynchronous I/O operation to complete

SYNOPSIS

#include <aio.h>

int aio_suspend(const struct aiocb * const list[], int nent, const struct timespec *timeout);

DESCRIPTION

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.

RETURN VALUE

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.

ERRORS

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.

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 this error.

EINTR

A signal was delivered to the process while aio_suspend() was waiting. Completion of asynchronous operations can cause signal delivery.

STANDARDS CONFORMANCE

aio_suspend(): POSIX Realtime Extensions, IEEE Std 1003.1b