aio_suspend(3)

NAME
aio_suspend - Wait until one or more requests of a specific set terminates.

SYNOPSYS
#include <errno.h>

#include <aio.h>

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

DESCRIPTION
Another method of synchronization is to wait until one or more requests of a specific set terminated. This could be achieved by the aio_* functions to notify the initiating process about the termination but in some situations this is not the ideal solution. In a program which constantly updates clients somehow connected to the server it is not always the best solution to go round robin since some connections might be slow. On the other hand letting the aio_* function notify the caller might also be not the best solution since whenever the process works on preparing data for on client it makes no sense to be interrupted by a notification since the new client will not be handled before the current client is served. For situations like this aio_suspend should be used.

When calling this function, the calling thread is suspended until at least one of the requests pointed to by the nent elements of the array list has completed. If any of the requests has already completed at the time aio_suspend is called, the function returns immediately. Whether a request has terminated or not is determined by comparing the error status of the request with EINPROGRESS an element of list is NULL , the entry is simply ignored. If no request has finished, the calling process is suspended. If timeout is NULL , the process is not woken until a request has finished. If timeout is not NULL , the process remains suspended at least as long as specified in timeout aio_suspend returns with an error.

When the sources are compiled with _FILE_OFFSET_BITS == 64 this function is in fact aio_suspend64 since the LFS interface transparently replaces the normal implementation.

RETURN VALUES
The return value of the function is 0 if one or more requests from the list have terminated. Otherwise the function returns -1 and errno is set.

ERRORS

EAGAIN
    None of the requests from the list completed in the time specified by timeout

EINTR
    A signal interrupted the aio_suspend function. This signal might also be sent by the AIO implementation while signalling the termination of one of the requests.

ENOSYS
    The aio_suspend function is not implemented.

SEE ALSO
aio(3), aio_cancel(3), aio_cancel64(3), aio_error(3), aio_error64(3), aio_fsync(3), aio_fsync64(3), aio_init(3), aio_read(3), aio_read64(3), aio_return(3), aio_return64(3), aio_suspend64(3), aio_write(3), aio_write64(3), errno(3),