From: Steinar H. Gunderson Date: Wed, 27 Jul 2016 19:46:37 +0000 (+0200) Subject: Set libusb timeout to one second, to help shutdown if the thread is started with... X-Git-Tag: 0.5~1 X-Git-Url: https://git.sesse.net/?p=bmusb;a=commitdiff_plain;h=d51fd416b5c2784b03ae50bda59cd01a881bf7df Set libusb timeout to one second, to help shutdown if the thread is started with zero cards active. --- diff --git a/bmusb.cpp b/bmusb.cpp index e9a9125..cd4e59c 100644 --- a/bmusb.cpp +++ b/bmusb.cpp @@ -878,7 +878,8 @@ void BMUSBCapture::usb_thread_func() printf("couldn't set realtime priority for USB thread: %s\n", strerror(errno)); } while (!should_quit) { - int rc = libusb_handle_events(nullptr); + timeval sec { 1, 0 }; + int rc = libusb_handle_events_timeout(nullptr, &sec); if (rc != LIBUSB_SUCCESS) break; }