summaryrefslogtreecommitdiff
path: root/libusb/os/threads_posix.c
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2020-02-07 15:47:55 -0800
committerChris Dickens <christopher.a.dickens@gmail.com>2020-02-07 15:47:55 -0800
commit9c28ad219b654011783a42ec888ca87dbda704a6 (patch)
treeb789d577d5547c0d7b247d165fe52dc96f5014c8 /libusb/os/threads_posix.c
parent67e6816264e35a1f22b43a78b4be7481652bc51a (diff)
downloadlibusb-9c28ad219b654011783a42ec888ca87dbda704a6.tar.gz
Windows: Refactoring to consolidate and simplify common code
Both the UsbDk and WinUSB backends perform common steps when handling transfers in order to interact with the poll abstraction, both during submission and when processing transfer completion. With some rearranging of shared structures, this can be yanked from the individual backends and placed in the common area. This allows for several functions to be removed outright from each backend. The cancellation logic can also be simplified by attempting CancelIoEx() at the highest level and delegating to the backend if there are alternatives to try should CancelIoEx() fail. After some analysis of how Windows processes asychronous (OVERLAPPED) requests that the underlying driver completes synchronously, it is now evident that such requests need not be handled in any special fashion. Each function that called a driver function that was expected to complete asynchronously had logic to handle the case of a synchronous completion, so this has all been killed off. This significantly cleans up these call sites as now they must only check for an error condition. Finally, the initialization code for the WinUSB backend has been reworked to load the WinUSB DLL independent of the libusbK DLL. Previously when the libusbK DLL was present, all requests to devices using WinUSB would first be sent through the libusbK DLL where they would then be forwarded to the WinUSB DLL. This is slightly inefficient but is also limiting when using Windows 8.1 or later because support for isochronous transfers through WinUSB will be lost. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/threads_posix.c')
0 files changed, 0 insertions, 0 deletions