File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -636,6 +636,8 @@ void usb_handler_thread::operator()()
636636 // Process asynchronous requests that are pending
637637 libusb_handle_events_timeout_completed (ctx, &lusb_tv, nullptr );
638638
639+ u64 delay = 1'000 ;
640+
639641 // Process fake transfers
640642 if (!fake_transfers.empty ())
641643 {
@@ -650,6 +652,13 @@ void usb_handler_thread::operator()()
650652
651653 if (transfer->expected_time > timestamp)
652654 {
655+ const u64 diff_time = transfer->expected_time - timestamp;
656+
657+ if (diff_time < delay)
658+ {
659+ delay = diff_time;
660+ }
661+
653662 ++it;
654663 continue ;
655664 }
@@ -668,7 +677,7 @@ void usb_handler_thread::operator()()
668677 if (handled_devices.empty ())
669678 thread_ctrl::wait_for (500'000 );
670679 else
671- thread_ctrl::wait_for (1'000 );
680+ thread_ctrl::wait_for (delay );
672681 }
673682}
674683
You can’t perform that action at this time.
0 commit comments