Which function should be protected by SDL_LockJoysticks()? I see that most functions call SDL_LockJoysticks() themselves.
A comment in SDL_JoystickUpdate() even says: “Make sure the list is unlocked while dispatching events to prevent application deadlocks”. So, which function should not be protected by SDL_LockJoysticks()?
I’d need to check specifics but a couple of days ago the iOS Xcode project file was broken in regard to some joystick stuff. Probably some new files not included.
This function allows you to make multiple calls to joystick info functions like SDL_JoystickNameForIndex(), SDL_JoystickGetDeviceGUID(), etc., guaranteeing that the list won’t change in between calls if a user happens to plug in or unplug a controller at just the right time.
It’s only needed if you’re pumping SDL events on a different thread than you’re calling joystick functions, so most applications shouldn’t need to worry about this.