Wait for asynchronous I/O operations to be completed
#include <aio.h> int aio_suspend( const struct aiocb * const list, int nent, const struct timespec * timeout );
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The aio_suspend() function suspends the calling thread until at least one of the asynchronous I/O operations referenced by the list argument has been completed, until a signal interrupts the function, or, if timeout isn't NULL, until the time interval specified by timeout has passed.
If any of the aiocb structures in the list correspond to completed asynchronous I/O operations (i.e. the error status for the operation isn't EINPROGRESS) at the time of the call, aio_suspend() returns without suspending the calling thread.
0 if one or more of the asynchronous I/O operations have been completed, otherwise -1 (errno is set).
You can determine which asynchronous I/O operations were completed by scanning the associated error and return status, using aio_error() and aio_return().
POSIX 1003.1 AIO
The first time you call an aio_* function, a thread pool is created, making your process multithreaded if it isn't already. The thread pool isn't destroyed until your process ends.
aio_cancel(), aio_error(), aio_fsync(), aio_read(), aio_return(), aio_write(), aiocb, lio_listio()