Exits when performing asynchronous I/O operations
A program might first issue asynchronous I/O operations using aio_read() or aio_write() and then call
() to terminate itself.
... aio_write(aiocbp); exit(0);
My question is, will the
exit() call wait until the asynchronous I/O completes or will the program simply terminate?
I believe the relevant language in the standard is:
Consequences of Process Termination
All of the file descriptors, directory streams, conversion descriptors, and message catalog descriptors open in the calling process shall be closed.
When there is an outstanding cancelable asynchronous I/O operation against fildes when close() is called, that I/O operation may be canceled. An I/O operation that is not canceled completes as if the close() operation had not yet occurred. All operations that are not canceled shall complete as if the close() blocked until the operations completed. The close() operation itself need not block awaiting such I/O completion. Whether any I/O operation is canceled, and which I/O operation may be canceled upon close(), is implementation-defined.
Therefore, it is unspecified; Either cancel the outstanding operation, or the operation blocks until it completes.