linux: Use a separate lock to serialize start/stop vs hotplug events
authorHans de Goede <hdegoede@redhat.com>
Tue, 30 Jul 2013 13:57:16 +0000 (15:57 +0200)
committerHans de Goede <hdegoede@redhat.com>
Tue, 30 Jul 2013 15:20:27 +0000 (17:20 +0200)
commitd8a33df7dda5ebfae0ffd6272183a546aa99547d
treea5862bc0f2344df0a00b8cb4e35421c006b55348
parent242d49c636b390d64740b79953c68c2b28cae8ff
linux: Use a separate lock to serialize start/stop vs hotplug events

Using one lock for this is a bad idea, as we should not be holding any
locks used by the hotplug thread when trying to stop otherwise the stop
function may wait indefinetely in pthread_join, while the event-thread
is waiting for the lock the caller of the stop function holds.

Using 2 separate locks for this should fix this deadlock, which has been
reported here: https://bugzilla.redhat.com/show_bug.cgi?id=985484

Many thanks to Chris Dickens for figuring out the cause of this deadlock!

CC: Chris Dickens <christopher.a.dickens@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/os/linux_usbfs.c
libusb/version_nano.h