summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libusb/os/windows_usb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index 0cec76a..e21a984 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -1923,6 +1923,7 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds,
// Because a Windows OVERLAPPED is used for poll emulation,
// a pollable fd is created and stored with each transfer
+ usbi_mutex_lock(&ctx->flying_transfers_lock);
list_for_each_entry(transfer, &ctx->flying_transfers, list, struct usbi_transfer) {
transfer_priv = usbi_transfer_get_os_priv(transfer);
if (transfer_priv->pollable_fd.fd == fds[i].fd) {
@@ -1930,6 +1931,7 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds,
break;
}
}
+ usbi_mutex_unlock(&ctx->flying_transfers_lock);
if (found) {
// Handle async requests that completed synchronously first