Fix 100% CPU usage when using libusb - #6083
Conversation
The dispatcher can't tell the difference between "timeout" and "empty", so it ends up infinte looping. Using a thread directly is much simpler and more correct.
6f863a7 to
e4e6927
Compare
|
@dorodnic, the broken |
| { | ||
| std::vector<usb_device_info> rv; | ||
| auto ctx = std::make_shared<usb_context>(); | ||
| auto ctx = get_usb_context(); |
There was a problem hiding this comment.
I went to clean up the fact that we are creating a usb_context every time we list devices, but before I could fix it, I noticed that @bfulkers-i had already fixed this as part of #5492!
There was a problem hiding this comment.
I plan to rebase #5492 on top of this once this gets merged.
4e7bf4a to
490e9a8
Compare
c3ccbec to
a6c17d2
Compare
|
Hi @radfordi However, this does not - Why? Both are sniping a thread doing essentially the same thing... It's unfortunate that I'll look deeper into it and merge the PR |
When |
|
Ok thank you |
Replace broken dispatcher with a thread to fix 100% CPU usage
The dispatcher can't tell the difference between "timeout" and "empty", so it ends up infinte looping. Using a thread directly is much simpler and more correct.
Fixes #5783. Fixes #6062.