Is there asynchronous file i/o in Android NDK?

2019-07-24 22:22发布

问题:

I had to save/load a lot of data stored at the sdcard in my C++ android-ndk code. However, I was told that there is no async file IO <aio.h> in Android NDK, is that right?

If so , can any of you give me an example (or guideline) of async read/write files in Android NDK? Thank you!

回答1:

You are correct, there is no AIO available in the latest Android NDK:

$ cd ~/android-ndk-r15/platforms/android-26
$ find . -type f -exec grep aiocb {} \;
$

What is your primary use? Asynchronized reading or writing? You may have to roll your own solution with multiple threads.

Or search github for existing solutions to portable async IO.