Clean up in-flight transfers and device handle when closing a device
authorVitali Lovich <vlovich@aliph.com>
Thu, 17 Mar 2011 02:51:40 +0000 (19:51 -0700)
committerPeter Stuge <peter@stuge.se>
Sun, 24 Jul 2011 20:29:09 +0000 (22:29 +0200)
commitc775c2f43037cd235b65410583179195e25f9c4a
tree54fb2d1a6ffb1cc21b9516738032a857fc08c7ce
parent74282582cc879f091ad1d847411337bc3fa78a2b
Clean up in-flight transfers and device handle when closing a device

Any in-flight transfers should properly invalidate their references
to device handles that are being closed.  Additionally, they should be
removed from the transfer-in-flight list.  This is done with the events
lock held to protect against another thread processing the same transfer.
The events lock is initialized as a recursive mutex, because the device
close code might itself be called while an event is being handled.
Fixes #82.

[stuge: Trivial rework to reduce indenting]
libusb/core.c
libusb/io.c