jbaldwin / libcoro

C++20 coroutine library
Apache License 2.0
605 stars 64 forks source link

Support for file IO? #171

Open yuzhichang opened 1 year ago

yuzhichang commented 1 year ago

asio supports io_uring. It's great if libcoro support async file IO (io_uring on Linux, IOCP on Windows etc.), so that read/write yield thread to another coroutine.

jbaldwin commented 1 year ago

I'm not that familiar with io_uring yet, it seems quite promising but this is definitely a larger task to either: (a) replace epoll with io_uring -- this solution would mandate a minimum kernel version probably (b) support both epoll and io_uring - I'm not particularly interested in this approach, I'd rather keep the code simple, I imagine there would be subtle bugs between the two kernel apis and would require a lot of testing and effort to maintain both

jbaldwin commented 11 months ago

Another option might be to have a background thread pool which blocks on the file io requests while maintaining epoll.