Asio certainly has support for asynchronous file IO. I have used it on linux systems for a multitude of file handle types, including console I/O.
Is there any function can handle the finished IO operation?
Assume I have two threads. One is only submit async io to file, and another one is only handle event of those executed io.
I only find handler function but wonder if any easier handler to handle all.
I'm not quite sure why you'd need two threads. But if you did, asio allows you to bind handlers to executors prior to submission to asynchronous initiating functions.
The handler will be executed by its associated executor, which could if you require be running in a different thread.
e.g.
async_write(f, buf, asio::bind_executor(other_executor,
[](error_code ec, std::size_t written) {
// handler now executed by other_executor
});
If submitting across threads you'd want to be sure to protect access to the file object with a mutex or a strand.