From 7648171fe2e19a650d1bd251e8b6d54558bfc17b Mon Sep 17 00:00:00 2001 From: brian218 Date: Thu, 26 Jan 2023 21:47:55 +0800 Subject: [PATCH] sys_usbd: Improved usb_handler_thread timing --- rpcs3/Emu/Cell/lv2/sys_usbd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index 26732ba6f1..bbd4dd9e54 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -367,7 +367,7 @@ usb_handler_thread::~usb_handler_thread() void usb_handler_thread::operator()() { - timeval lusb_tv{0, 200}; + timeval lusb_tv{0, 0}; while (ctx && thread_ctrl::state() != thread_state::aborting) { @@ -405,7 +405,10 @@ void usb_handler_thread::operator()() } // If there is no handled devices usb thread is not actively needed - thread_ctrl::wait_for(handled_devices.empty() ? 500'000 : 200); + if (handled_devices.empty()) + thread_ctrl::wait_for(500'000); + else + std::this_thread::yield(); } }