Any suggestion on how to go idle until an SDL event is available?
On Apple platforms, the main thread’s run loop services the main dispatch queue. Search swift-corelibs-foundation for _dispatch_main_queue_callback_4CF to see how this works. Looking at the code, it seems to be set up to function on Linux, leaving you with one of two possibilities:
-
There’s some sort of bug.
-
SDL’s main loop is not running the run loop on Linux
It’s seems likely it’s the latter.
As to how you fix this, there’s a bunch of potential approaches you can take, but the most important thing is how you integrate with SDL’s abstractions. I think you should dig into SDL_WaitEvent to see how it works on Apple platforms. Given that Swift’s Foundation brings run loop along with it, it’s possible you could just switch it over to using run loops on Linux.
Share and Enjoy
Quinn “The Eskimo!” @ DTS @ Apple