Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review joystick locking #6063

Closed
slouken opened this issue Aug 16, 2022 · 2 comments
Closed

Review joystick locking #6063

slouken opened this issue Aug 16, 2022 · 2 comments
Assignees
Milestone

Comments

@slouken
Copy link
Collaborator

slouken commented Aug 16, 2022

There are some potential issues where joystick data structures aren't locked while delivering events. This was intentional to avoid a deadlock in Steam, but we should review this and see if we can leave the lock held during all accesses to joystick data structures.

@slouken slouken added this to the 2.26.0 milestone Aug 16, 2022
@slouken slouken self-assigned this Aug 16, 2022
slouken added a commit that referenced this issue Aug 16, 2022
This prevents crashes when calling SDL joystick API functions from a different thread while disconnection is happening.

See #6063 for a more thorough review of joystick locking.
@slouken
Copy link
Collaborator Author

slouken commented Aug 27, 2022

Consider #6150 when reviewing locking

@slouken
Copy link
Collaborator Author

slouken commented Aug 28, 2022

Also look at the similar issue in #6145

PJB3005 pushed a commit to PJB3005/SDL that referenced this issue Oct 5, 2022
This prevents crashes when calling SDL joystick API functions from a different thread while disconnection is happening.

See libsdl-org#6063 for a more thorough review of joystick locking.
PJB3005 pushed a commit to PJB3005/SDL that referenced this issue Oct 5, 2022
This makes the joystick locking more robust by holding the lock while updating joysticks.

The lock should be held when calling any SDL joystick function on a different thread than the one calling SDL_PumpEvents() and SDL_JoystickUpdate().

It is now possible to hold the lock while reinitializing the joystick subsystem, however any open joysticks will become invalid and potentially cause crashes if used afterwards.

Fixes libsdl-org#6063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant