|
From: Richard H. <hug...@gm...> - 2022-10-14 14:10:21
|
Hi all, I wrote a PR for libgusb (a GObject wrapper around libusb) to reinstate the libusb_pollfd-based integration for GSource. The link to what I've done is here: https://github.com/hughsie/libgusb/blob/wip/hughsie/GUsbSource/gusb/gusb-source.c which is based on some code Hans de Goede wrote a *long* time ago. This fixes a deadlock in fwupd when lots of threads are in flight doing USB stuff to devices, but unexpectedly breaks fprintd. Could a libusb_pollfd expert (if there is such a thing!) have a look at the source file above and tell me if the locking is done correctly? Maybe GSource doesn't quite have the semantics that libusb_lock_events is expecting? I've attached a gdb backtrace of fprintd if that might be helpful. I'm not really sure that fprintf should be iterating the main context with g_main_context_iteration() but I don't think it's the source of this issue. It looks like usbi_mutex_lock(ctx->open_devs_lock) seems to be blocking -- but all the users of it look fine, and I *should* be running from a single thread now. Ideas welcome! Thanks. Richard. |