mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-04 13:07:32 +00:00
FreeBSD 11.4's libusb10_handle_events_sub ends every pass, a timed-out one included, with pthread_cond_broadcast on the context's condition variable, so a thread in libusb_wait_for_event wakes after each pass of the handler. Here waiters woke only when the handler unlocked, so a waiter could sleep through the handler's whole loop. Notify them when the handler takes the event lock back after a pass. The follower test that expected a timeout while the handler ran 20 ms passes now races that wake-up, so guest_usbd checks three cases instead: a follower with a long timeout returns 0 after a pass, a follower times out during a longer pass, and a follower returns after the handler held the event lock past its timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]>