1diff --git a/libusb/libusb.h b/libusb/libusb.h
2index e8e1201..15bd0d5 100644
3--- a/libusb/libusb.h
4+++ b/libusb/libusb.h
5@@ -25,6 +25,12 @@
6 #define LIBUSB_H
7 
8 #ifdef _MSC_VER
9+// Disable warning 4200 for [0].
10+#pragma warning(push)
11+#pragma warning(disable: 4200)
12+#endif
13+
14+#ifdef _MSC_VER
15 /* on MS environments, the inline keyword is available in C++ only */
16 #if !defined(__cplusplus)
17 #define inline __inline
18@@ -1938,4 +1944,8 @@ void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
19 }
20 #endif
21 
22+#ifdef _MSC_VER
23+#pragma warning(pop)
24+#endif
25+
26 #endif
27diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c
28index 9769f58..46f6db7 100644
29--- a/libusb/os/threads_posix.c
30+++ b/libusb/os/threads_posix.c
31@@ -20,11 +20,6 @@
32  */
33 
34 #if defined(__linux__) || defined(__OpenBSD__)
35-# if defined(__linux__)
36-#  define _GNU_SOURCE
37-# else
38-#  define _BSD_SOURCE
39-# endif
40 # include <unistd.h>
41 # include <sys/syscall.h>
42 #elif defined(__APPLE__)
43diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
44index 63357b1..51ce55d 100644
45--- a/libusb/os/windows_usb.c
46+++ b/libusb/os/windows_usb.c
47@@ -2142,6 +2142,7 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds,
48 			windows_handle_callback(transfer, io_result, io_size);
49 		} else {
50 			usbi_err(ctx, "could not find a matching transfer for fd %x", fds[i]);
51+			usbi_mutex_unlock(&ctx->open_devs_lock);
52 			return LIBUSB_ERROR_NOT_FOUND;
53 		}
54 	}
55