[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    aiowait(3) manual page Table of Contents

Name

aiowait - wait for completion of asynchronous I/O operation

Synopsis

cc [ flag ... ] file ... -laio [ library ... ]


#include <sys/asynch.h>
#include <sys/time.h>

aio_result_t *aiowait(const struct timeval *timeout);

MT-Level

Unsafe

Description

aiowait() suspends the calling process until one of its outstanding asynchronous I/O operations completes. This provides a synchronous method of notification.

If timeout is a non-zero pointer, it specifies a maximum interval to wait for the completion of an asynchronous I/O operation. If timeout is a zero pointer, then aiowait() blocks indefinitely. To effect a poll, the timeout parameter should be non-zero, pointing to a zero-valued timeval structure.

The timeval structure is defined in <sys/time.h> and contains the following members:


    long  tv_sec;        /* seconds */
    long  tv_usec;        /* and microseconds */

Return Values

On success, aiowait() returns a pointer to the result structure used when the completed asynchronous I/O operation was requested. On failure, it returns -1 and sets errno to indicate the error. aiowait() returns 0 if the time limit expires.

Errors

EFAULT
timeout points to an address outside the address space of the requesting process. See NOTES below.
EINTR
aiowait() was interrupted by a signal.
EINVAL
There are no outstanding asynchronous I/O requests.

See Also

aiocancel(3) , aioread(3)

Notes

aiowait() is the only way to dequeue an asynchronous notification. It may be used either inside a SIGIO signal handler or in the main program. One SIGIO signal may represent several queued events.

Passing an illegal address as timeout will result in setting errno to EFAULT only if it is detected by the application process.


Table of Contents