New async I/O and task dispatcher library for SDL

Hey, I haven’t been active in a few years and lost my old email, but some of you who’ve been around since then might remember me as nfries88.

You might remember that I really wanted an asynchronous file I/O API added to SDL2 when it was still pretty new

So after years of not developing at all, I started writing an extension library to do just that, and some other things I think will be helpful in general to modern game developers. zlib licensed just like SDL so you can use it on iOS and other systems that don’t have or allow dynamic linking

You can find it in my old mercurial repository on sourceforge:

I’ve been out of the coding game awhile, so I’m sure there’s some bugs to be found, more strenuous testing than my simple test program will be appreciated too!

The I/O system has a dummy implementation that just uses SDL_RWops (this requires locking because of the internal position maintenance), a posix implementation that just uses pread/pwrite (this is similar to what glibc does under the hood for implementing the aio_* posix calls, unfortunately there’s really nothing much better out there for those systems (epoll, kqueue, etc don’t work the same for normal disk files as they do for sockets and pipes)), and I/O Completion ports on Windows. All I/O implementations support working on RWops too, although I’d avoid it.

(note: I’m not actually set up with Linux or another Unix-like system, the posix implementation was tested with the compatibility wrappers provided by mingw)

(note: the other project in that repository, SDL_Crash, was more useful in 2013 when 32-bit intel machines were more common. I’m not sure how useful it is now that more gaming is done on ARM devices and 64-bit intel machines. It could be facelifted for ARM and x64 but I’m not in a hurry to dive back into that one, it was mostly made as a learning experience in the first place)

It’s been a weeks and there’s been no response, but that doesn’t mean nobody’s interested so I’ll just drop here that I have fixed a couple bugs, a couple things that might have lead to bugs with some misuse, and added two writer-preferring RWLock implementations (neither of which are recursive). I plan on doing some work with allocators next.