hughsie / libgusb

GUsb is a GObject wrapper for libusb1
GNU Lesser General Public License v2.1
25 stars 21 forks source link

Use GRecMutex to avoid a single-threaded lockup #81

Closed hughsie closed 2 years ago

hughsie commented 2 years ago

If we call libusb_get_bos_descriptor() in the hotplug device-add handler then we eventually call libusb_handle_events_completed() which can run handle_events -- which might emit devices. Using a mutex that's safe for recursing prevents the deadlock.

This fixes half the problem when getting descriptors on deeply nested USB hubs.