Am I right in thinking that AIO completion notifications (whether done via threads or signals) give you no information as to which request has completed? Is there any way to accomplish this correlation other than having separate callback functions called for each request? Ostensibly you can use the original request’s aiocb structure to make calls to aio_error and aio_return, but you don’t get a pointer back to the aiocb structure as part of the notification callback. Why does there seem to be no mechanism to do this?
Am I right in thinking that AIO completion notifications (whether done via threads or
Share
When you submit a
struct aiocbto initiate the asynchronous IO, you’re allowed to populate itsaio_sigeventmember with astruct sigeventstructure:Using
aio_sigevent.sigev_value.sival_ptryou can store a pointer to yourstruct aiocb(or another structure that has yourstruct aiocbas a member) which you can then look up when your signal handler is called:The
aio(7)manpage was extremely helpful when researching this and thesigevent(7)manpage has details on thestruct sigeventstructure.