SDL icon indicating copy to clipboard operation
SDL copied to clipboard

AsyncIO: SDL_AsyncIOFromFile could be asynchronous?

Open thatcosmonaut opened this issue 1 year ago • 2 comments

io_uring allows for async file opening, so it's possible that AsyncIOFromFile could take the queue object as an argument and make this operation optionally non-blocking depending on the backend. If the argument against is that this makes the behavior inconsistent across implementations, I understand, but I wanted to raise the issue just in case.

thatcosmonaut avatar Dec 05 '24 18:12 thatcosmonaut

It could also make sense to use a threadpool for 'async' opens on targets that don't natively have them. Opening a file isn't guaranteed to be fast on Windows, thanks to filter drivers, virus scanners, etc.

kg avatar Dec 05 '24 18:12 kg

We opted not to do it because only io_uring supported it, and we are hoping that opening is (generally) a fast operation, but also we were concerned about the added complexity to the app in making this part also async.

But let me think about it a bit.

icculus avatar Dec 05 '24 23:12 icculus

I don't think this is going to happen for 3.2.0. @kg made a good point about all the crap that can slow an open operation down, but it's going to add some internal complexity we don't have time to do correctly right now, and would make the API harder to use.

If/when we do this, I'd want it to be a separate function, available for those that want more power at the cost of more complexity, so there's no harm in adding it later.

icculus avatar Jan 04 '25 09:01 icculus