Open athairus opened 9 years ago
a static pointer to the "latest" instance of Core used. That's not thread-safe.
With a minor modification, it is.
libretro v2 will contain userdata pointers on the callbacks, but it keeps getting delayed, so I wouldn't recommend waiting.
It seems clear as I work through the code that in order to have multiple instances of Core, each running in their own thread, we're going to have to do better than using a static pointer to the "latest" instance of Core used. That's not thread-safe.
The biggest issue is that callbacks need to access non-static members of Core, but the callbacks' function signatures do not have a spot for the hidden "this" needed to do this.
Anyway, C++11 provides a way to do callbacks with class functions: http://stackoverflow.com/a/14189561/4190028