Asynchronous I/O control block
#include <aio.h> struct aiocb { int aio_fildes; int aio_reqprio; #if _FILE_OFFSET_BITS - 0 == 64 off_t aio_offset; #elif !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS == 32 #if defined(__LITTLEENDIAN__) off_t aio_offset; off_t aio_offset_hi; #elif defined(__BIGENDIAN__) off_t aio_offset_hi; off_t aio_offset; #else #error endian not configured for system #endif #else #error _FILE_OFFSET_BITS value is unsupported #endif __volatile void* aio_buf; size_t aio_nbytes; struct sigevent aio_sigevent; int aio_lio_opcode; ssize_t _aio_reserved; int _aio_pad[3]; ... }; #if _LARGEFILE64_SOURCE - 0 > 0 struct aiocb64 { int aio_fildes; int aio_reqprio; off64_t aio_offset; __volatile void* aio_buf; size_t aio_nbytes; struct sigevent aio_sigevent; int aio_lio_opcode; ssize_t _aio_reserved; int _aio_pad[3]; ... }; #endif /* _LARGEFILE64_SOURCE */
The aiocb and aiocb64 structures define the control block for asynchronous I/O operations. They include at least the following:
aiocb is POSIX 1003.1 AIO; aiocb64 is Large-file support
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.