core: Simplify thread abstractions and add debug checks
authorChris Dickens <christopher.a.dickens@gmail.com>
Thu, 27 Aug 2020 00:42:59 +0000 (17:42 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Sun, 13 Sep 2020 07:06:11 +0000 (00:06 -0700)
commit11cc9952823fbb47b7596aec30a205f68f3a8062
tree2ee8b88459c08d2b91faeed59c3095d34e25c2b1
parentda5df37c4d1a2841c6f9cdc626386d096f5f312d
core: Simplify thread abstractions and add debug checks

The POSIX thread mutex initialization function can potentially fail, but
in practice this is unlikely to occur. There is also inconsistent use of
the result of the mutex initialization within the library. The result is
only checked for mutexes in the libusb_device and libusb_device_handle
structures but is ignored in all other cases.

Simplify the mutex initialization function by changing the abstraction's
wrapper to a void function, much like all the other functions that
already exist. To that end, introduce macros for the abstractions that
will check the return value on debug builds.

Also remove the dependence on the core library needing errno.h to
translate errors from usbi_cond_timedwait(). The abstraction will
convert the implementation-specific error codes to LIBUSB_ERROR values.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/core.c
libusb/io.c
libusb/os/threads_posix.c
libusb/os/threads_posix.h
libusb/os/threads_windows.c
libusb/os/threads_windows.h
libusb/version_nano.h