mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 14:04:25 +00:00
Use a timeout with usb handle events set to a nominal 200ms and wait for the polling thread to shut down before deinitialising libusb.
This commit is contained in:
parent
9f8023a959
commit
56edabc64d
@ -3218,8 +3218,6 @@ static void __kill_work(void)
|
|||||||
/* Release USB resources in case it's a restart
|
/* Release USB resources in case it's a restart
|
||||||
* and not a QUIT */
|
* and not a QUIT */
|
||||||
if (!opt_scrypt) {
|
if (!opt_scrypt) {
|
||||||
usb_polling = false;
|
|
||||||
|
|
||||||
applog(LOG_DEBUG, "Releasing all USB devices");
|
applog(LOG_DEBUG, "Releasing all USB devices");
|
||||||
usb_cleanup();
|
usb_cleanup();
|
||||||
|
|
||||||
@ -7221,6 +7219,8 @@ static void clean_up(void)
|
|||||||
clear_adl(nDevs);
|
clear_adl(nDevs);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_USBUTILS
|
#ifdef USE_USBUTILS
|
||||||
|
usb_polling = false;
|
||||||
|
pthread_join(usb_poll_thread, NULL);
|
||||||
libusb_exit(NULL);
|
libusb_exit(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -7792,11 +7792,12 @@ 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, 200000};
|
||||||
|
|
||||||
RenameThread("usbpoll");
|
RenameThread("usbpoll");
|
||||||
|
|
||||||
pthread_detach(pthread_self());
|
|
||||||
while (usb_polling)
|
while (usb_polling)
|
||||||
libusb_handle_events(NULL);
|
libusb_handle_events_timeout_completed(NULL, &tv_end, NULL);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user