mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 05:41:55 +00:00
Keep the libusb event handle polling thread active until there are no async usb transfers in progress.
This commit is contained in:
parent
824aa5cb51
commit
81dfe60d36
15
cgminer.c
15
cgminer.c
@ -7798,17 +7798,24 @@ static void probe_pools(void)
|
|||||||
#ifdef USE_USBUTILS
|
#ifdef USE_USBUTILS
|
||||||
static void *libusb_poll_thread(void __maybe_unused *arg)
|
static void *libusb_poll_thread(void __maybe_unused *arg)
|
||||||
{
|
{
|
||||||
struct timeval tv_end = {0, 100000};
|
struct timeval tv_end = {1, 0};
|
||||||
|
bool inprogress = false;
|
||||||
|
|
||||||
RenameThread("usbpoll");
|
RenameThread("usbpoll");
|
||||||
|
|
||||||
while (usb_polling)
|
while (usb_polling)
|
||||||
libusb_handle_events_timeout_completed(NULL, &tv_end, NULL);
|
libusb_handle_events_timeout_completed(NULL, &tv_end, NULL);
|
||||||
/* One longer poll on shut down to enable drivers to hopefully cleanly
|
|
||||||
* shut down. */
|
/* Keep event handling going until there are no async transfers in
|
||||||
tv_end.tv_sec = 1;
|
* flight. */
|
||||||
|
do {
|
||||||
libusb_handle_events_timeout_completed(NULL, &tv_end, NULL);
|
libusb_handle_events_timeout_completed(NULL, &tv_end, NULL);
|
||||||
|
|
||||||
|
cg_rlock(&cgusb_fd_lock);
|
||||||
|
inprogress = !!cgusb_transfers;
|
||||||
|
cg_runlock(&cgusb_fd_lock);
|
||||||
|
} while (inprogress);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,8 @@
|
|||||||
#define DEFAULT_EP_IN 0
|
#define DEFAULT_EP_IN 0
|
||||||
#define DEFAULT_EP_OUT 1
|
#define DEFAULT_EP_OUT 1
|
||||||
|
|
||||||
|
int cgusb_transfers;
|
||||||
|
|
||||||
struct usb_epinfo {
|
struct usb_epinfo {
|
||||||
uint8_t att;
|
uint8_t att;
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user