diff options
author | Vitali Lovich <vlovich@aliph.com> | 2011-03-16 19:43:30 -0700 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2011-07-24 22:29:09 +0200 |
commit | 74282582cc879f091ad1d847411337bc3fa78a2b (patch) | |
tree | b90980dff598e1b026c7cd22fc27037ed0419fa8 /libusb/os/threads_windows.h | |
parent | 8f1bc0659136faf312dabe8fe67380a798299d33 (diff) | |
download | libusb-74282582cc879f091ad1d847411337bc3fa78a2b.tar.gz |
Add recursive mutexes to threading abstraction
This is necessary for the device close path which needs to attain the
events lock, but which might itself be called while handling an event.
The events lock is necessary to properly clean up transfers which might
still be pointing to the device. References #82.
[stuge: Move usbi_mutex_init_recursive() into threads_posix.c]
[stuge: Must also #define _XOPEN_SOURCE 500 to be able to build]
[pbatard: Un-inline usbi_mutex_init_recursive() to make Cygwin happy]
Diffstat (limited to 'libusb/os/threads_windows.h')
-rw-r--r-- | libusb/os/threads_windows.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libusb/os/threads_windows.h b/libusb/os/threads_windows.h index 2cd1867..34ae64c 100644 --- a/libusb/os/threads_windows.h +++ b/libusb/os/threads_windows.h @@ -58,6 +58,8 @@ struct timespec { #define usbi_mutexattr_t void #define usbi_condattr_t void +// all Windows mutexes are recursive +#define usbi_mutex_init_recursive(mutex, attr) usbi_mutex_init((mutex), (attr)) int usbi_mutex_static_lock(usbi_mutex_static_t *mutex); int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex); |