I'm working with kernel-level async I/O (i.e. libaio.h
). Prior to submitting a struct iocb
using io_submit
I set the callback using io_set_callback
that sticks a function pointer in iocb->data
. Finally, I get the completed events using io_getevents
and run each callback.
I'd like to be able to use some context information within the callback (e.g. a submission timestamp). The only method by which I can think of doing this is to continue using io_getevents
, but have iocb->data
point to a struct with context and the callback.
Is there any other methods for doing something like this, and is iocb->data
guaranteed to be untouched when using io_getevents
? My understanding is that there is another method by which libaio
will automatically run callbacks which would be an issue if iocb->data
wasn't pointing to a function.
Any clarification here would be nice. The documentation on libaio
seems to really be lacking.