summaryrefslogtreecommitdiff
path: root/libusb/os/threads_windows.h
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/os/threads_windows.h')
-rw-r--r--libusb/os/threads_windows.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/libusb/os/threads_windows.h b/libusb/os/threads_windows.h
index 409de2d..e971163 100644
--- a/libusb/os/threads_windows.h
+++ b/libusb/os/threads_windows.h
@@ -22,12 +22,12 @@
#define LIBUSB_THREADS_WINDOWS_H
#define USBI_MUTEX_INITIALIZER 0L
-#ifdef _WIN32_WCE
typedef LONG usbi_mutex_static_t;
-#else
-typedef volatile LONG usbi_mutex_static_t;
-#endif
-void usbi_mutex_static_lock(usbi_mutex_static_t *mutex);
+static inline void usbi_mutex_static_lock(usbi_mutex_static_t *mutex)
+{
+ while (InterlockedExchange(mutex, 1L) == 1L)
+ SleepEx(0, TRUE);
+}
static inline void usbi_mutex_static_unlock(usbi_mutex_static_t *mutex)
{
InterlockedExchange(mutex, 0L);