mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-13 06:01:03 +00:00
Keep a global counter of how many async usb transfers are in place.
This commit is contained in:
parent
856471e392
commit
824aa5cb51
@ -93,6 +93,10 @@
|
|||||||
.epinfos = _epinfosy \
|
.epinfos = _epinfosy \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Keep a global counter of how many async transfers are in place to avoid
|
||||||
|
* shutting down the usb polling thread while they exist. */
|
||||||
|
int cgusb_transfers;
|
||||||
|
|
||||||
#ifdef USE_BFLSC
|
#ifdef USE_BFLSC
|
||||||
// N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1
|
// N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1
|
||||||
static struct usb_epinfo bas_epinfos[] = {
|
static struct usb_epinfo bas_epinfos[] = {
|
||||||
@ -2223,6 +2227,10 @@ static void complete_usb_transfer(struct usb_transfer *ut)
|
|||||||
{
|
{
|
||||||
cgsem_destroy(&ut->cgsem);
|
cgsem_destroy(&ut->cgsem);
|
||||||
libusb_free_transfer(ut->transfer);
|
libusb_free_transfer(ut->transfer);
|
||||||
|
|
||||||
|
cg_wlock(&cgusb_fd_lock);
|
||||||
|
cgusb_transfers--;
|
||||||
|
cg_wunlock(&cgusb_fd_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LIBUSB_CALL transfer_callback(struct libusb_transfer *transfer)
|
static void LIBUSB_CALL transfer_callback(struct libusb_transfer *transfer)
|
||||||
@ -2289,6 +2297,7 @@ static int usb_submit_transfer(struct libusb_transfer *transfer)
|
|||||||
|
|
||||||
cg_wlock(&cgusb_fd_lock);
|
cg_wlock(&cgusb_fd_lock);
|
||||||
err = libusb_submit_transfer(transfer);
|
err = libusb_submit_transfer(transfer);
|
||||||
|
cgusb_transfers++;
|
||||||
cg_wunlock(&cgusb_fd_lock);
|
cg_wunlock(&cgusb_fd_lock);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user