diff options
author | Cameron Gutman <aicommander@gmail.com> | 2021-01-01 17:34:07 -0600 |
---|---|---|
committer | Cameron Gutman <aicommander@gmail.com> | 2021-01-01 17:34:07 -0600 |
commit | ebbeda7a0a491264ec2b5740759491836a722488 (patch) | |
tree | 76eeeacefa5b148b0c8e81ed5a291920ca7e88f8 /Xcode | |
parent | 93f52fd375e3a84586da3b953987ed62c32615db (diff) | |
download | sdl-ebbeda7a0a491264ec2b5740759491836a722488.tar.gz |
Do not wait in GetOverlappedResult() in hid_read_timeout()
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.
Diffstat (limited to 'Xcode')
0 files changed, 0 insertions, 0 deletions