mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 08:28:29 +00:00
Fixed HIDAPI controller disconnect reading on multiple threads
If multiple threads are calling SDL_UpdateJoysticks(), then an overlapped read can be initiated on one thread (read_pending set to true) and GetOverlappedResult() called on another thread. This results in ERROR_OPERATION_ABORTED. This is harmless so we shouldn't return an error in this case, we'll just retry the read on the next call. Fixes https://github.com/libsdl-org/SDL/issues/14033
This commit is contained in:
@@ -1399,6 +1399,11 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
if (GetLastError() == ERROR_OPERATION_ABORTED) {
|
||||||
|
/* The read request was issued on another thread.
|
||||||
|
This is harmless, so just ignore it. */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
register_winapi_error(dev, L"hid_read_timeout/GetOverlappedResult");
|
register_winapi_error(dev, L"hid_read_timeout/GetOverlappedResult");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user