I am writing a virtual machine emulator. The emulated code can create a number of timers, each of which can have an independent expiration time. When expiry happens, a single bit in a u64 is set.
This seems simple enough, but when I last attempted this task, I spent about a month figuring out how to work around various thread-related issues (e.g., structs not implementing Send, that sort of thing). After some discussion on Mastodon, it was eventually decided that it is basically impossible to implement, as the SDL2 bindings were currently written.
So, after coming back to this problem after a month of other work, I'm now asking here. Surely, someone here has to be familiar with the correct use of SDL2 timers. How would you go about doing something like this?
BTW, I apologize for not having precise code in hand when asking this question. I've long since deleted the errant code I've written before. I'll try my hand again, but I also am interested in fresh approaches I might not have thought of. So I'm deliberately making this an open-ended question, which I can focus down later on, perhaps in another thread. Thanks in advance.