core: Add internal transfer state management
authorChris Dickens <christopher.a.dickens@gmail.com>
Mon, 19 Jan 2015 01:07:13 +0000 (17:07 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Sun, 1 Mar 2015 08:08:23 +0000 (00:08 -0800)
commita886bb02c87dd5faf271fad595e4622f7027d347
tree3fa3a9cde0fccbf8af42f52a54f75f5374cb15b8
parentb000fe1821dceb5e19fc811a6ee2b977205d4034
core: Add internal transfer state management

This patch adds some new flags to keep track of transfer state.
These flags are used to properly handle transfers that are on
the flying_transfers list for devices that are disconnected.

The motivation for this patch is to release the requirement of
holding the flying_transfers_lock for the duration of a call to
libusb_submit_transfer(). Holding this lock is the simplest and
safest way to submit a transfer, but it has performance impacts
as it serializes transfer submission for a given context.

With proper transfer state management, the library can handle a
device disconnect without needing to prevent multiple transfers
from being concurrently submitted.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/io.c
libusb/libusbi.h
libusb/os/linux_usbfs.c
libusb/version_nano.h