hughsie / libgusb

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

Wip/hughsie/g usb source #82

Closed hughsie closed 2 years ago

benzea commented 2 years ago

Uh, that sounds "fun". I don't really have an opinion on using a custom GSource vs. threading. In a way, GSource seems nicer to me personally, but there must have been some reason in the past to do use the threaded approach.

I am not quite sure why it could recurse through the hotplug code. I mean, any hotplug event coming from libusb is first pushed into an idle handler. Maybe the recursion is happening through some other place? Or it is some corner case that happens during enumeration?

hughsie commented 2 years ago

but there must have been some reason in the past to do use the threaded approach

FreeBSD and Windows

I mean, any hotplug event coming from libusb is first pushed into an idle handler.

Right, but it's re-entrant because of the thread. That means the lock gets taken twice by each thread.