Use separate libusb contexts to avoid thread safety issues

Unfortunately, it appears that using libusb's synchronous transfer API
from several threads causes nasty race conditions in event handling and
can lead to deadlocks, despite the fact that libusb's synchronous API
is documented to be perfectly fine to use from several threads (only
the manual polling functionality is supposed to require special
precautions).

Since usbdk was the only real reason for using a single libusb context
and since usbdk (currently) has so many issues with Dolphin, I think
dropping support for it in order to fix other backends is acceptable.
This commit is contained in:
Léo Lam
2019-06-25 17:31:35 +02:00
parent 769ba43abf
commit cf60a9a7f7
8 changed files with 16 additions and 26 deletions

View File

@ -35,7 +35,7 @@ std::map<std::pair<u16, u16>, std::string> GetInsertedDevices()
std::map<std::pair<u16, u16>, std::string> devices;
#ifdef __LIBUSB__
auto& context = LibusbUtils::GetContext();
LibusbUtils::Context context;
if (!context.IsValid())
return devices;