diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2018-01-03 21:18:02 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2018-01-03 23:24:27 -0800 |
commit | 4be320236ec485dd32ada1b85d4c0551274d1f8a (patch) | |
tree | fddb9d2d5e6fa1e18d4ebdfdf5a0b6b684c97dfd /libusb/os/windows_nt_common.c | |
parent | 3001f934776c5bb61a735fe676c3d82e69c47868 (diff) | |
download | libusb-4be320236ec485dd32ada1b85d4c0551274d1f8a.tar.gz |
Windows: Improve locking in threading abstraction
Convert the usbi_mutex_t type to a CRITICAL_SECTION object. There
are numerous advantages including lower resource usage and a better
fast-path (doesn't require entering kernel space).
Simplify the condition variable implementation by not associating a
wait structure with a particular thread ID. This is not needed and
causes an unnecessary search through the linked list of any available
wait structures when the real optimization is just reusing an already
created event object.
Also, while here remove all the checks for NULL pointers because we
don't do such a silly thing inside the library.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/windows_nt_common.c')
-rw-r--r-- | libusb/os/windows_nt_common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libusb/os/windows_nt_common.c b/libusb/os/windows_nt_common.c index d935394..94f8770 100644 --- a/libusb/os/windows_nt_common.c +++ b/libusb/os/windows_nt_common.c @@ -123,7 +123,7 @@ typedef struct htab_entry { } htab_entry; static htab_entry *htab_table = NULL; -static usbi_mutex_t htab_mutex = NULL; +static usbi_mutex_t htab_mutex; static unsigned long htab_filled; /* Before using the hash table we must allocate memory for it. |