Also fixes a segmentation fault when exiting winedevice.exe. I can file a separate bug report, but it seems related to Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52213
On my system the core dump can be provoked when using the bus_udev backend in winebus.sys ("Enable SDL" 0). It creates two hid devices - a mouse and a keyboard. Since it resides in the same winedevice.exe process as wineusb.sys, something similar to the above bug occurs when handling the SIGQUIT signal. The actual crash happens in the libusb event thread while waiting in pthread_cond_wait().
I'm using this for months without any issues (with a device driver which uses wineusb.sys for device access, etc.).
-- v4: wineusb.sys: Move event handling to a single thread.