# aio_suspend

## NAME



           aio_suspend - wait for asynchronous I/O operation or timeout
    


## LIBRARY



           Real-time library (_librt_ , _-lrt_)
    


## SYNOPSIS



           **#include <aio.h>**
    
           **int aio_suspend(** int n;
                           **const struct aiocb *const** _aiocb_list_**[**_n_**], int** _n_**,**
                           **const struct timespec *restrict** _timeout_**);**
    


## DESCRIPTION



           The **aio_suspend**() function suspends the calling thread until one
           of the following occurs:
    
           •  One or more of the asynchronous I/O requests in the list
              _aiocb_list_ has completed.
    
           •  A signal is delivered.
    
           •  _timeout_ is not NULL and the specified time interval has passed.
              (For details of the _timespec_ structure, see nanosleep(2).)
    
           The _n_ argument specifies the number of items in _aiocb_list_.  Each
           item in the list pointed to by _aiocb_list_ must be either NULL (and
           then is ignored), or a pointer to a control block on which I/O was
           initiated using aio_read(3), aio_write(3), or lio_listio(3).  (See
           aio(7) for a description of the _aiocb_ structure.)
    
           If **CLOCK_MONOTONIC** is supported, this clock is used to measure the
           timeout interval (see clock_gettime(2)).
    


## RETURN VALUE



           If this function returns after completion of one of the I/O
           requests specified in _aiocb_list_ , 0 is returned.  Otherwise, -1 is
           returned, and _errno_ is set to indicate the error.
    


## ERRORS



           **EAGAIN** The call timed out before any of the indicated operations
                  had completed.
    
           **EINTR** The call was ended by signal (possibly the completion
                  signal of one of the operations we were waiting for); see
                  signal(7).
    
           **ENOSYS aio_suspend**() is not implemented.
    


## ATTRIBUTES



           For an explanation of the terms used in this section, see
           attributes(7).
           ┌──────────────────────────────────────┬───────────────┬─────────┐
           │ **Interface** │ **Attribute** │ **Value** │
           ├──────────────────────────────────────┼───────────────┼─────────┤
           │ **aio_suspend**()                        │ Thread safety │ MT-Safe │
           └──────────────────────────────────────┴───────────────┴─────────┘
    


## STANDARDS



           POSIX.1-2008.
    


## NOTES



           One can achieve polling by using a non-NULL _timeout_ that specifies
           a zero time interval.
    
           If one or more of the asynchronous I/O operations specified in
           _aiocb_list_ has already completed at the time of the call to
           **aio_suspend**(), then the call returns immediately.
    
           To determine which I/O operations have completed after a
           successful return from **aio_suspend**(), use aio_error(3) to scan the
           list of _aiocb_ structures pointed to by _aiocb_list_.
    


## BUGS



           The glibc implementation of **aio_suspend**() is not async-signal-
           safe, in violation of the requirements of POSIX.1.
    


* * *