mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 19:55:19 +00:00
Android: prevent SDLActivity and Main Thread to access mJoystick at the
same time. same for mHapticHandler
This commit is contained in:
parent
6f45f97af0
commit
a35bcad0be
1 changed files with 4 additions and 4 deletions
|
|
@ -211,7 +211,7 @@ class SDLJoystickHandler {
|
|||
/**
|
||||
* Handles adding and removing of input devices.
|
||||
*/
|
||||
void pollInputDevices() {
|
||||
synchronized void pollInputDevices() {
|
||||
int[] deviceIds = InputDevice.getDeviceIds();
|
||||
|
||||
for (int device_id : deviceIds) {
|
||||
|
|
@ -307,7 +307,7 @@ class SDLJoystickHandler {
|
|||
}
|
||||
}
|
||||
|
||||
protected SDLJoystick getJoystick(int device_id) {
|
||||
synchronized protected SDLJoystick getJoystick(int device_id) {
|
||||
for (SDLJoystick joystick : mJoysticks) {
|
||||
if (joystick.device_id == device_id) {
|
||||
return joystick;
|
||||
|
|
@ -642,7 +642,7 @@ class SDLHapticHandler {
|
|||
}
|
||||
}
|
||||
|
||||
void pollHapticDevices() {
|
||||
synchronized void pollHapticDevices() {
|
||||
|
||||
final int deviceId_VIBRATOR_SERVICE = 999999;
|
||||
boolean hasVibratorService = false;
|
||||
|
|
@ -690,7 +690,7 @@ class SDLHapticHandler {
|
|||
}
|
||||
}
|
||||
|
||||
protected SDLHaptic getHaptic(int device_id) {
|
||||
synchronized protected SDLHaptic getHaptic(int device_id) {
|
||||
for (SDLHaptic haptic : mHaptics) {
|
||||
if (haptic.device_id == device_id) {
|
||||
return haptic;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue