Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hidapi/windows: do not wait in GetOverlappedResult() in hid_read_time…
…out() (#577) This is unsafe because the event is auto-reset, therefore the call to WaitForSingleObject() resets the event which GetOverlappedResult() will try to wait on. Even though the overlapped operation is guaranteed to be completed at the point we call GetOverlappedResult(), it will still wait on the event handle for a short time to trigger the reset for auto-reset events. This amounts to roughly a 100 ms sleep each time GetOverlappedResult() is called for a completed I/O with a non-signalled event. In the context of HIDAPI, this extra sleep means that callers that loop on hid_read_timeout() with timeout=0 will loop forever, since the 100 ms sleep each iteration ensures ReadFile() will always have new data. Signed-off-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Sam Lantinga <slouken@libsdl.org>
- Loading branch information