Fix #168 - Windows: Support timeout on Interface::control_in and control_out#169
Fix #168 - Windows: Support timeout on Interface::control_in and control_out#169piersfinlayson wants to merge 1 commit intokevinmehall:mainfrom
Conversation
|
This seems like a good idea - it's annoying not to be able to control the timeout on Windows. Note that there is a race here in the case where the same
Of course, having two threads making control requests to the same device/interface simultaneously is an odd thing to do, and would almost certainly to lead to other problems anyway, but I figured it was still worth pointing this out. If we care, we could avoid this possibility by having the code hold a lock whilst setting the timeout and submitting the transfer. Another possible improvement: the current timeout value could be stashed (e.g. in |
|
Yes, the reason I didn't implement it like this is because of the race condition @martinling mentioned. It's not clear whether The way I was considering doing this is like the Linux implementation: set our own timer and cancel the transfer after the timeout. This would allow the timeouts of each transfer to be set independently like on the other platforms. I was looking at using A lock around the entire transfer would be another way to be able to use WinUSB's timeout safely, but it would have to be semi-custom to work with either async or blocking waits and return a |
|
@kevinmehall Thanks for the input. Are you're planning a CreateThreadpoolTimer version and do you have a rough ETA on that? Need to decide what to do with my dependent crate in the meantime. |
|
Work in progress on #171 |
Per #168.
As well as potentially setting the timeout with a new (Windows only) method on Device, it is also arguable that control_in and control_out should reset the timeout to 5000ms after the transfer.