core: Refactor initialization and how the default context is handled
authorChris Dickens <christopher.a.dickens@gmail.com>
Wed, 20 Jan 2021 19:18:35 +0000 (11:18 -0800)
committerNathan Hjelm <hjelmn@google.com>
Thu, 3 Jun 2021 04:53:59 +0000 (22:53 -0600)
commit32a22069428cda9d63aa666e92fb8882a83d4515
tree241a205a8683f199871abc45117feaa1d8cdf79d
parenta2b81aeff1178a1c186986b1c608247b44b657f0
core: Refactor initialization and how the default context is handled

Highlights for this change:

 - usbi_default_context is only set if libusb_init() is called with NULL.
 - All hotplug related functionality (e.g. initialization, processing) has been
   moved to hotplug.c
 - Backends are simplified by removing initialization mutexes. Mutual exclusion
   between init()/exit() is provided by default_context_lock.
 - Make hotplug types and functions part of libusbi.h with the common usbi_
   prefixes (removes hotplug.h).

Addresses issue highlighted in #855

Closes #856

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
28 files changed:
Xcode/libusb.xcodeproj/project.pbxproj
doc/Makefile.in
doc/doxygen.cfg.in
libusb/Makefile.am
libusb/core.c
libusb/hotplug.c
libusb/hotplug.h [deleted file]
libusb/io.c
libusb/libusbi.h
libusb/os/darwin_usb.c
libusb/os/linux_usbfs.c
libusb/os/windows_common.c
msvc/libusb_dll_2013.vcxproj
msvc/libusb_dll_2013.vcxproj.filters
msvc/libusb_dll_2015.vcxproj
msvc/libusb_dll_2015.vcxproj.filters
msvc/libusb_dll_2017.vcxproj
msvc/libusb_dll_2017.vcxproj.filters
msvc/libusb_dll_2019.vcxproj
msvc/libusb_dll_2019.vcxproj.filters
msvc/libusb_static_2013.vcxproj
msvc/libusb_static_2013.vcxproj.filters
msvc/libusb_static_2015.vcxproj
msvc/libusb_static_2015.vcxproj.filters
msvc/libusb_static_2017.vcxproj
msvc/libusb_static_2017.vcxproj.filters
msvc/libusb_static_2019.vcxproj
msvc/libusb_static_2019.vcxproj.filters