Merge "adb: fix deadlock." am: 68599f5759 am: d5a2cdb72c

am: a08c949c7a

Change-Id: I2e4c442084c710444de0192b2d4bc901c17fc92f
This commit is contained in:
Josh Gao 2017-05-31 02:21:19 +00:00 committed by android-build-merger
commit 86d63c89b0

View file

@ -427,11 +427,15 @@ static void device_disconnected(libusb_device* device) {
static int hotplug_callback(libusb_context*, libusb_device* device, libusb_hotplug_event event,
void*) {
if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
device_connected(device);
} else if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) {
device_disconnected(device);
}
// We're called with the libusb lock taken. Call these on the main thread outside of this
// function so that the usb_handle mutex is always taken before the libusb mutex.
fdevent_run_on_main_thread([device, event]() {
if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
device_connected(device);
} else if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) {
device_disconnected(device);
}
});
return 0;
}