I am calling something like this in a Background task in OSX:
while (joystickPollingEnabled) {
SDL_Event e;
while (SDL_PollEvent(&e)) {
joyManager.handleJoystickEvents(&e);
}
if (joystickPollingEnabled) { // no delay if it need to exit
SDL_Delay(12);
SDL_WaitEventTimeout(NULL, 500);
}
}
I read on the documentation that I cant do this in a bg thread, but I am currently only using SDL joystick in my app.
And disabled every other event using:
SDL_EventState(SDL_LASTEVENT, SDL_DISABLE);
SDL_JoystickEventState(SDL_ENABLE);
So, it seems to be working…
Is it SAFE?
Thanks