diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2018-01-06 21:43:12 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2018-01-06 21:43:12 -0800 |
commit | d0779e93032affec1dcf04a5bba18f3968aa7922 (patch) | |
tree | 2609450edece322a4421764a2d804fa7607a1214 /libusb/os/windows_winusb.h | |
parent | 0865774fe93b2d0d9729ab23f9dfb10af1433312 (diff) | |
download | libusb-d0779e93032affec1dcf04a5bba18f3968aa7922.tar.gz |
Windows: Rework poll() emulation to a much simpler and effective design
The previous poll() implementation worked okay but had some issues. It
was inefficient, had a large footprint, and there were simply some use
cases that didn't work (e.g. a synchronous transfer that completes when
no other event or transfer is pending would not be processed until the
next poll() timeout).
This commit introduces a new, simpler design that simply associates an
OVERLAPPED structure to an integer that acts as a file descriptor. The
poll() emulation now solely cares about the OVERLAPPED structure, not
transfers or HANDLEs or cancelation functions. These details have been
moved up into the higher OS-specific layers.
For Windows NT environments, several deficiencies have been addressed:
1) It was previously possible to successfully submit a transfer but fail
to add the "file descriptor" to the pollfd set. This was silently
ignored and would result in the user never seeing the transfer being
completed.
2) Synchronously completed transfers would previously not be processed
unless another event (such as a timeout or other transfer completion)
was processed.
3) Canceling any one transfer on an endpoint would previously result in
*all* transfers on that endpoint being canceled, due to the use of
the AbortPipe() function.
This commit addresses all of these issues. In particular, run-time
detection of the CancelIoEx() function will allow the user to cancel a
single outstanding transfer without affecting any others still in
process.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/windows_winusb.h')
-rw-r--r-- | libusb/os/windows_winusb.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libusb/os/windows_winusb.h b/libusb/os/windows_winusb.h index b0e834a..fb0a4e7 100644 --- a/libusb/os/windows_winusb.h +++ b/libusb/os/windows_winusb.h @@ -277,6 +277,7 @@ static inline struct windows_device_handle_priv *_device_handle_priv( // used for async polling functions struct windows_transfer_priv { struct winfd pollable_fd; + HANDLE handle; uint8_t interface_number; uint8_t *hid_buffer; // 1 byte extended data buffer, required for HID uint8_t *hid_dest; // transfer buffer destination, required for HID |